extjs4 - Extjs window close event -
i have window cancel button , default close[x]. when user clicks cancel button, should check specific flag , close window , updates db. using me.close(this); closing window cancel button. when user clicks on [x], should check same flag , updates db , close window. checking flag condition, added listener listener works fine. after adding listener, clicking cancel button, close event called twice. db updation happens twice. advice me how handle [x] close event window
ext.define('myapp.view.updateform', { extend: 'ext.window.window', height: 600, width: 800, layout: { type: 'absolute' }, title: 'update window', modal: true, initcomponent: function() { ext.applyif(me, { items: [ { xtype: 'button', id:'btncancel', handler : function(){ if(flag == true){ //add db me.close(this); } } }] }); me.callparent(arguments); }, listeners:{ close:function(){ if(flag == true){ alert("close window"); //add db } } } });
i have done exact implementation minor differences , can attest works expected.
here code:
ext.create('ext.window.window', { ... buttons:[ { text:'finish', handler:function () { this.up('window').close(); } } ], listeners:{ close:this.somefunction, scope:this } ....
this works perfectly. tells me issues elsewhere in code.
Comments
Post a Comment