页面树结构
转至元数据结尾
转至元数据起始

正在查看旧版本。 查看 当前版本.

与当前比较 查看页面历史

版本 1 当前 »

示例说明

在灵活分析工具栏中添加"录制"和"停止录制"按钮,点击新增按钮,执行自定义操作。并且监听灵活分析数据刷新后的事件,进行自定义操作。

修改ConfigurationPatch.js扩展点配置文件

var ConfigurationPatch = {
	extensionPoints : {
		QueryView : {
			handlers : [ {
				className : "bof.gzgs.themejump.ThemeJumpQueryViewHandler"
			} ]
		}
	}
};


ThemeJumpQueryViewHandler对象实现

var ThemeJumpQueryViewHandler = function(queryView) {
	this.queryView = queryView;
    //监听数据刷新后的事件
	this.queryView.afterRefresh.subscribe(this.doAfterRefresh, this);
};
lang.extend(ThemeJumpQueryViewHandler, "freequery.widget.Module2");

ThemeJumpQueryViewHandler.prototype.destroy = function() {
	ThemeJumpQueryViewHandler.superclass.destroy.call(this);
};

// 扩展点1:添加工具栏按钮
ThemeJumpQueryViewHandler.prototype.readConfig = function() {
	var config = {
		toolbar : {
			items : [ {
				bofid : "_spaceThemeJump",
				image : "img/banner/toolbar_tab_space.gif"
			}, {
				bofid : "startRecordThemeJump",
				image : "img/themejump/START_RECORD.gif",
				title : "录制",
				command : "START_RECORD_THEME_JUMP"
			}, {
				bofid : "stopRecordThemeJump",
				image : "img/themejump/STOP_RECORD.gif",
				title : "停止录制",
				command : "STOP_RECORD_THEME_JUMP"
			} ]
		}
	};
	return config;
};
// 执行自定义按钮点击事件
ThemeJumpQueryViewHandler.prototype.execute = function(cmd, btn) {
	switch (cmd) {
		case "START_RECORD_THEME_JUMP":
		case "STOP_RECORD_THEME_JUMP":
			alert(cmd + ", " + btn.getAttribute("bofid"));
			break;
	}
};
// 扩展点2:监听已有事件
ThemeJumpQueryViewHandler.prototype.doAfterRefresh = function(queryView) {
	alert("Refresh data called.");
};
  • 无标签