There is no simple method of hiding and showing a Dijit ContentPane.
If you are displaying a number of ContentPanes within a TabContainer you may need to hide (and possibly redisplay) one or more of the ContentPanes. For instance if the tabs are displaying information based on a selected product/user/etc… some tabs might not be relevant depending on the selected product/user/etc… If you can change the selected product/user/etc… via JavaScript/AJAX, you need to be able to hide and redisplay ContentPanes.
You can remove a ContentPane by calling removeChild on the TabContainer, however if you want to be able to re-display the ContentPane later, you need to save the Dijit widget to a global JavaScript variable before you remove it.
For example assuming your page has this:
……
You can hide MyTab like this:
saveMyTabWidget = dijit.byId(‘MyTab’);
dijit.byId(‘MyTabContainer’).removeChild(dijit.byId(‘MyTab’));
And then, to redisplay, you’ll want to check if the saveMyTabWidget variable has been set, and if so, add it back as a child to the TabContainer, like this:
if (typeof saveMyTabWidget != “undefined”) {
saveMyTabWidget.setHref(theURL);
dijit.byId(‘MyTabContainer’).addChild(saveMyTabWidget, 0);
saleProductsTabWidget = undefined;
}
Leave a Reply