问题我可能没讲清楚
超过4个后面的ButtonCellType引用的是同一个,改变其中一个ButtonCellType的text时,其他几个会一起发生改变
var rowCount =5;
var colCount=5;
for (var i = 0; i < rowCount; i++) {
for (var j = 0; j < colCount; j++) {
var cell = sheet.getCell(i, j);
initFileCell(cell);
}
}
function initFileCell(cell) {
var btnFile = new $.wijmo.wijspread.ButtonCellType();
btnFile.text("详 情");
cell.cellType(btnFile);
cell.hAlign($.wijmo.wijspread.HorizontalAlign.center);
}
//注册按钮事件
spread.bind($.wijmo.wijspread.Events.ButtonClicked, function(e, args) {
var row = args.row, col = args.col;
var cellType = sheet.getCellType(row, col);
if ( cellType instanceof $.wijmo.wijspread.ButtonCellType) {
//弹出对话框改变按钮的文本
fileDiag.showDiag(enable);
}
}); |