View Full Version : Get Handle of Close button on Tab.
I want to call a function when a document is closed directly from its tab instead of the close button provided on the form.
Can anyone provide me necessary code to handle the event of closing tab. ?
Please find the screenshot to know which tab I actually mean.
Thanks In Advance.
RWaters
4 Jan 2010, 1:19 PM
There are several events that are fired whenever a panel is closed, you probably are looking for something along the lines of the 'beforedestroy' event on the panel itself. Where things get complicated is that if you're utilizing the built-in Ext.nd functionality of opening a document into a new tab, then you've lost control over the piece of code that creates the panel and adds it to the tabpanel. I'll see what we can do to expose these events in an easier fashion in the future, but for now you should be able to make changes to the Ext.nd.util.addIFrame function to add your code.
If you look through that section you'll see some code that adds a 'beforedestroy' listener to the panel.
if (window == window.top) {
panel.on('beforedestroy', function(panel) {
...
I would recommend adding an additional listener and not utilizing the same one. What will make this even more difficult is if you want to only do this for certain types of documents, as this code was meant to be generically used on any view to open documents into a container.
If you need it to only apply to specific views you can look into overriding the openDocument method of the view you're dealing with and changing it to not use the built-in Ext.nd.util.addIFrame method (you could basically copy what it is doing, but give yourself a place to attach the new 'beforedestroy' listener)
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.