我现在要添加行 ,但是 这个方法没有用,也没抱错,
function processContextMenuClicked(action) {
var sheet = spread.getActiveSheet();
var sheetArea = $("#spreadContextMenu").data("sheetArea");
hideSpreadContextMenu();
switch (action) {
case 1:
if (sheetArea === spreadNS.SheetArea.colHeader) {
var insertColumnIndex = sheet.getActiveColumnIndex();
var colCount = sheet.getSelections()[0].colCount;
sheet.addColumns(insertColumnIndex, colCount);
for (var i = 0; i < colCount; i++) {
sheet.copyTo(-1, insertColumnIndex - 1, -1, insertColumnIndex + i, -1, 1, GC.Spread.Sheets.CopyToOptions.style);
}
} else if (sheetArea === spreadNS.SheetArea.rowHeader) {
var insertRowIndex = sheet.getActiveRowIndex();
var rowCount = sheet.getSelections()[0].rowCount;
sheet.addRows(insertRowIndex, rowCount);
for (var i = 0; i < rowCount; i++) {
sheet.copyTo(insertRowIndex - 1, -1, insertRowIndex + i, -1, 1, -1, GC.Spread.Sheets.CopyToOptions.style);
}
}
break;
default:
if (sheetArea === spreadNS.SheetArea.colHeader) {
sheet.deleteColumns(sheet.getActiveColumnIndex(), sheet.getSelections()[0].colCount);
} else if (sheetArea === spreadNS.SheetArea.rowHeader) {
sheet.deleteRows(sheet.getActiveRowIndex(), sheet.getSelections()[0].rowCount);
}
break;
}
}
|
|