您好,请参考以下代码,从注释“添加逻辑”处开始到这个方法结束的位置。添加位置是在designer.loader.ready中。
- designer.loader.ready(function () {
- //To Fix the designer resize performance issues.
- $(window).unbind("resize.gcuiribbon");
- $("#verticalSplitter").show();
- updateLayout();
- // 添加逻辑
- var spread = GC.Spread.Sheets.findControl("ss");
- var undoManager = spread.undoManager();
- var sheetFlg = false;
- var sheetNum = spread.getSheetCount();
- spread.bind(GC.Spread.Sheets.Events.ActiveSheetChanged, function (sender, args) {
- if(spread.getSheetCount() !== sheetNum){
- sheetFlg = true;
- }
- });
- window.onbeforeunload=function(e){
- if(undoManager.canUndo() || sheetFlg){
- var e = window.event||e;
- e.returnValue=("确定离开当前页面吗?");
- }
- }
- });
复制代码 |