之前您提供的全选功能代码有点复杂,我没有看明白。请问我现在这种形式,想实现全选切换该怎么处理呢?因为在行号上加的checkbox没有名字,没有class,没法赋值
途中代码拷贝如下:
$(document).ready(function () {
var spread = new GC.Spread.Sheets.Workbook($("#content").get(0), {
sheetCount: 1
});
var sheet = spread.getActiveSheet();
getdata(sheet);
//设置第一列不可见
sheet.setColumnVisible(0, false);
spread.options.newTabVisible = false;
var rowcount = sheet.getRowCount();
var colcount = sheet.getColumnCount();
for (var i = 0; i < rowcount; i++) {
sheet.setCellType(i, 0, new GC.Spread.Sheets.CellTypes.CheckBox(), GC.Spread.Sheets.SheetArea.rowHeader);
}
for (var j = 0; j < colcount + 1; j++) {
sheet.setColumnWidth(j, 98);
}
$('#all').click(function () {
if ($(this).attr("checked") == "checked") {
//实现全选切换
}
})
});
|