Posted 14 September 2017, 11:23 am EST
Hello, is it possible to make individual cells read-only in FlexSheet?
Forums Home / Wijmo / General Discussion
Posted by: mau7038 on 14 September 2017, 11:23 am EST
Posted 14 September 2017, 11:23 am EST
Hello, is it possible to make individual cells read-only in FlexSheet?
Posted 14 September 2017, 11:23 am EST
Hello,
I could not find a direct way to disable individual cells in FlexSheet. I have escalated the issue to the concerned team for further discussion. I will let you know as soon as I get any information in this regard.
Thanks,
Manpreet Kaur
Posted 14 September 2017, 11:23 am EST
Hello,
As per the development team, you can use the beginningEdit event of FlexSheet to disable the individual cell. Please refer the snippet:
[js]
flexSheet.beginningEdit.addHandler(function (sender, e) {
if (e.row === 1 && e.col === 1) {
e.cancel = true;
}
});
[/js]
Hope it helps.
Thanks,
Manpreet Kaur
Posted 13 April 2018, 12:18 am EST
I found this solution only sort of works for my use case:
I have multiple sheets in a workbook, and adding the above event handler causes the cell to be disabled on all sheets. (every sheet’s row 1 col 1 is frozen).
Is there not a better way to do this than a handler on the whole grid? Can it be tied to the individual worksheet? As you can imagine, freezing every cell of the workbook is not my intention.
The below works to make a column read only (DOES NOT WORK FOR ROW) on a particular sheet (just set the active sheet before setting the read only). Can a similar attribute be added to a cell and row?
// references FlexSheet named ‘ServerWorkbook’ in the view
@ViewChild(‘ServerWorkbook’) ServerWorkbook: wjcGridSheet.FlexSheet;
// stuff . . . then when applying formats on a per sheet Index:
this.ServerWorkbook.sheets.selectedIndex = sheetIndex;
this.ServerWorkbook.sheets[sheetIndex].grid.columns[8].isReadOnly = true;