PDA

View Full Version : Hide tab rather than close?



kelv1n
24 Dec 2011, 7:44 AM
Hi Guys

When clicking the close button on a tab, the Tab appears to be destroyed - How can I hide and remove it from the Tab Panel, rather than destroying it? Then at a later time re-show it?

Basically I'm using the Extjs 4 MVC, my app has a Tree for navigation on the Left and Tabs on the right, when a Tree item is selected, it opens a Tab, but when the User closes it, it seems pointless having to recreate each tab and reload the data next time, it seems wasteful :) there are possibly better approaches, so I'd be open for suggestions aswell.

Thanks
Kelvin

kelv1n
24 Dec 2011, 12:06 PM
I found 1 way around this, which was to add a listener to BeforeClose, but the interesting thing is calling Hide() on tab (p) did not work, instead I've had to call hide on both the tab and element.. Is there a more elegant way of doing this???



onClose: function(p) {
p.tab.hide();
p.getEl().hide();


return false;
}

skirtle
24 Dec 2011, 8:02 PM
Does it work if you remove it rather than hiding it, being careful not to destroy it?

Though I understand where you're coming from, I wonder whether users will find it irritating that closing and reopening a tab doesn't reset it.