Posted 15 May 2019, 7:11 pm EST
Hi,
This a known issue which is now fixed in the internal build. Fix will be included in the next stable build.
Till then you may override the insertSheet command with a custom one to detect sheets insertion. Please refer to the following code snippet and the attached sample:
function updateInsertSheetCommand(spread){
var menuData = spread.contextMenu.menuData;
for(var i = 0; i < menuData.length; i++){
if(menuData[i].command == "gc.spread.contextMenu.insertSheet"){
menuData[i].command = "insertSheet";
break;
}
}
var command = {
canUndo: false,
execute: function (wbContext, options, isUndo) {
var oldSheet = wbContext.getSheetFromName(options.sheetName);
var newSheet = new GC.Spread.Sheets.Worksheet();
wbContext.addSheet(wbContext.getSheetIndex(options.sheetName), newSheet);
setTimeout(function(){
onActiveSheetChanged(oldSheet, newSheet);
});
return true;
}
};
var commandManager = spread.commandManager();
commandManager.register("insertSheet", command, null, false, false, false, false);
}
Regards
updateContextMenuCommand.zip