本帖最后由 fgb1990 于 2020-10-14 09:25 编辑
确实加上单元格级别的样式就可以编辑了,但是我不明白为什么其他没用复选框的列,只用列级别的样式就可以编辑,有复选框的列就不行。另外加单元格级别的样式后,页面加载会慢很多。请看代码:
sheet.options.isProtected = true;
var styleCanEdit = new GC.Spread.Sheets.Style();
styleCanEdit.locked = false;
var styleNoCanEdit = new GC.Spread.Sheets.Style();
styleNoCanEdit.locked = true;
sheet.setStyle(-1, -1, styleNoCanEdit, GC.Spread.Sheets.SheetArea.viewport);
sheet.setStyle(-1, 9, styleCanEdit, GC.Spread.Sheets.SheetArea.viewport);
sheet.setStyle(-1, 10, styleCanEdit, GC.Spread.Sheets.SheetArea.viewport);
sheet.setStyle(-1, 11, styleCanEdit, GC.Spread.Sheets.SheetArea.viewport);
for (let index = 0; index < sheet.getRowCount(); index++) {
sheet.setStyle(index, 10, styleCanEdit, GC.Spread.Sheets.SheetArea.viewport);
}
var c = new GC.Spread.Sheets.CellTypes.CheckBox();
sheet.setCellType(-1, 10, c, GC.Spread.Sheets.SheetArea.viewport);
还有一个问题:点击复选框单元格的时候为什么不会触发cellClick()事件?
|