您好,
我通过下面的方式,在js中设置一个单元格为复选框,但是有时候就会出现勾选不了,并且控制台会报下面的截图中的错误。我用的是v9版本的。
function settype(row,col) {
// 设置单元格为复选框
var spread = GcSpread.Sheets.findControl($('#ss')[0]);
var sheet = spread.getSheet(0);
spread.suspendEvent();
sheet.setColumnWidth(0,106.0,GcSpread.Sheets.SheetArea .viewport);
var cellType = new GcSpread.Sheets.CheckBoxCellType();
sheet.getCell(row,col).cellType(cellType);
// 复选框居中
var cell = sheet.getCell(row,col,GcSpread.Sheets.SheetArea.viewport);
sheet.getCell(row,col).text(true);
cell.hAlign(GcSpread.Sheets.HorizontalAlign.center);
cell.vAlign (GcSpread.Sheets.VerticalAlign.center);
spread.resumeEvent();
}
Uncaught InvalidStateError: Failed to set the 'selectionEnd' property on 'HTMLInputElement': The input element's type ('checkbox') does not support selection.
|
|