Posted 25 July 2019, 12:47 pm EST
I’m following the documentation here: https://us.grapecitydev.com/wijmo/demos/Grid/Editing/Read-only/angular
My requirement is that, based on a boolean attribute in the component, I need to be able to make an entire FlexGrid Read Only.
I have a grid (#flex) that calls this on:
(initialized)="initializeGrid(flex)"
The init function is basically from the Docs except for the if(this._isReadOnly) condition.
initializeGrid(flex: wjcGrid.FlexGrid) {
flex.beginningEdit.addHandler((s: wjcGrid.FlexGrid, e: wjcGrid.CellRangeEventArgs) => {
let item = s.rows[e.row].dataItem;
if (this._isReadOnly) { // prevent editing if read only is enabled
console.log("Read Only",this._isReadOnly);
e.cancel = true;
}
});
}
Where this._isReadOnly is a boolean toggled true/false based on external logic. For testing I’m toggling with a button, and can confirm the state change, but the grid does not become read only.
I’ve tried re-running the initializeGrid function on the grid after the state change to no effect - I don’t know if I need to remove the initial handler, or update the handler.
Even setting the condition to _isReadOnly=true when the component initializes doesn’t actually make the FlexGrid read only, so clearly I’m missing something here.
Some clarity here would be very much appreciated.