Ext事件,哈哈没有flex的事件爽
var myEventer;//事件对象;var MyEventer = function(){this.addEvents({//声明一系列事件,形成一个事件链; "createLineFinished": true,//动态创建一行完成;(先触发1) "createLineFinishedAfter": true,//动态创建一行完成之后;(后触发2) "loadFeatureDataFinish": true,//加载数据完成;(后触发3) "loadedAllDataFinish": true//所有数据加载完成; });}Ext.extend(MyEventer, Ext.util.Observable);
myEventer = new MyEventer();myEventer.on("createLineFinished", function(){createTabFinished++;myEventer.fireEvent("createLineFinishedAfter", createTabFinished);});myEventer.on("loadedAllDataFinish", function(){//本页已经初始化完成;if(loadPanelMask)loadPanelMask.hide();//去掉遮罩loadPanelMask在add_tagruler.html声明;});
?
?
<script type="text/javascript">// /构建自定义组件Person = function(config) {// /属性构建Ext.apply(this, config);this.addEvents({"xxxuuu" : true,"quit" : true});}// /必须继承Ext.util.Observable// /this.fireEvent触发事件,并将参数传递过去)Ext.extend(Person, Ext.util.Observable, {// /定义属性及其默认参数和事件school : 'XIhuan',age : '90',address : 'MianYang',xxxuuu : function() {this.fireEvent('xxxuuu', this)},quit : function() {this.wv = function() {this.fireEvent('quit', this)dom = null;} this.wv();}}); Ext.onReady(function() { var p = new Person(); p.on("quit", function(e){ alert(e.age); }); p.quit(); }); </script>?