示例说明
在可视化查询工具栏屏蔽"保存"按钮,并在"保存"按钮之前添加"自定义保存"按钮,点击新增按钮,执行自定义操作。
修改ConfigurationPatch.js扩展点配置文件
var ConfigurationPatch = { extensionPoints: { BusinessView: { handlers: [{ className: "ext.gzgs.handler.BusinessViewHandler" }] } } };
BusinessViewHandler对象实现
var util = jsloader.resolve("freequery.common.util"); var BusinessViewHandler = function(businessView) { this.businessView = businessView; this.queryType = this.businessView.bv.queryType; }; lang.extend(BusinessViewHandler, "freequery.widget.Module2"); BusinessViewHandler.prototype.destroy = function() { BusinessViewHandler.superclass.destroy.call(this); }; BusinessViewHandler.prototype.isEnabled = function(){ return true; } BusinessViewHandler.prototype.readConfig = function() { var config = { toolbar : { items : [ { id : "saveEx", image : "img/save.gif", title : "保存", command : "SAVE_BUSINESS",//用于下面execute方法 before : "save" }] } }; return config; }; BusinessViewHandler.prototype.execute = function(cmd, btn) { switch (cmd) { case "SAVE_BUSINESS": try { this.businessView.onSave(); }catch (e){ break; } break; } };