PDA

View Full Version : Dynamically closing contentpanel with tabs



oregontarheel
16 Apr 2007, 10:16 AM
Hello all-

I have a series of content panels with tabs, and I want to close one using a javascript handler, but all i can find in the ContentPanel class is a destroy method, which clears the panel but doesn't get rid of the tab. Is there any function that will emulate the user clicking on the tab close "X" button? Also, is there an event that fires when this happens, again I was only able to find activate and deactivate in that class, and that appears to fire every time i switch tabs, instead of just when the tab is closed. Thanks in advance!

kubens
16 Apr 2007, 11:17 AM
May this is what you are looking for:



layout.getRegion('west').remove('panelId');


Br
Wolfgang

oregontarheel
16 Apr 2007, 11:57 AM
Thanks! That was exactly what I was looking for...

any idea how to trigger an event when this happens? Is the event registered on the panel or the parent container?

tryanDLS
16 Apr 2007, 12:02 PM
Look at doc for layoutRegion - the events are beforeremove and panelremoved

oregontarheel
16 Apr 2007, 1:28 PM
Thanks!

for reference purposes, here's how I got this to work:



layout.getRegion('center').on('beforeremove', removePanel);


where removePanel is my event handling function. Thanks everyone for your quick and friendly help! Ext is great!