"确定按钮"没有可重写的对应命令,可以考虑自定义工具栏的”删除重复值“按钮命令。
示例代码可参考:
- var removeDuplicatesCommand = GC.Spread.Sheets.Designer.getCommand(GC.Spread.Sheets.Designer.CommandNames.RemoveDuplicates);
- if (removeDuplicatesCommand) {
- var oldExecute = removeDuplicatesCommand.execute;
- removeDuplicatesCommand.execute = function (context, propertyName, args) {
- //添加自定义判断逻辑
- var row = 1;
- if(row != 1) {
- oldExecute.call(this, context, propertyName, args);
- } else {
- alert("禁止删除");
- }
- }
- }
- var designerConfig = JSON.parse(JSON.stringify(GC.Spread.Sheets.Designer.DefaultConfig));
- designerConfig.commandMap = {};
- designerConfig.commandMap[GC.Spread.Sheets.Designer.CommandNames.RemoveDuplicates] = removeDuplicatesCommand;
- // 初始化designer
- var designer = new GC.Spread.Sheets.Designer.Designer("gc-designer-container", designerConfig);
复制代码 |