I'm trying to run some code when closing a tab, is there an event for this? I've tried onbeforeclose and onbeforedestroy, but they don't seem to have an effect.
Is this 1.x or 2.0? No event names are preferenced by 'on' in either version.
Exactly! That's the right place.
What you're probably seeing are the functions that handle processing for some event. For example for an event named 'click', there may be a function called 'onClick' that's doing some processing related to the event.
Thanks! I'm starting to understand now... I've sort of just started out blindly copying from the Feed viewer example and working on it until I've gotten something that works reasonably well, but I don't always understand why things are done exactly the way they are. I think the appropriate place for this would be 'listeners' in the objects config:
EditForm.superclass.constructor.call(this, {
bodyStyle: 'padding: 5px 5px 5px 5px',
closable: true,
autoScroll: true,
border: false,
bodyBorder: false,
deferredRender: false,
tbar: [ this.saveButton ],
items: [ this.form ],
listeners: {
'beforedestroy': function() {
tinyMCE.removeInstances(this.id);
}
},
scope: this
});
Event names in Ext do NOT begin with on. There are panel events: beforeclose, close.
I'd seen some events starting with 'on' when extending with ext.extend in the Feed panel example and mistakenly assumed this meant other events was also prefixed with on when extended this way.
Now it works:
Ext.extend( EditForm, Ext.Panel, {
beforeDestroy : function(e) {console.log('It works!')}
});
I'd seen some events starting with 'on' when extending with ext.extend in the Feed panel example and mistakenly assumed this meant other events was also prefixed with on when extended this way.
Now it works:
Ext.extend( EditForm, Ext.Panel, {
beforeDestroy : function(e) {console.log('It works!')}
});
You override panel's beforeDestroy method by the above code in fact. Relation of beforeDestroy to events is only that that it is called from beforedestroy event listener.
Beware, overriding default methods of Ext components can be dangerous. Of course, you can do so but you must be sure that you know what you are doing.
Problem interacting with flash application
Correct sequence for grid?
|