PDA

View Full Version : if Panel exists....



xnakxx
25 Oct 2010, 10:05 AM
I have a Tabpanel the I reuse throughout my app, adding a map panel if a Ajax call returns successfully.
dynamically adding and removing the "map" panel has been no problem but I am running into a situation where I need to check to the map panel exists before trying to remove it, kinda of a reset.
What would be the easiest and or proper way to do this?

Im was trying something like this


if(Ext.getCmp('map')) {
alert("map is there");
p.remove(map, true);
...
}just a stab in the dark really, hoping that getCmp would return false if it could not find "map"

mikeyroy
25 Oct 2010, 10:29 AM
This is how I do it:


if (typeof(BT.App.ui.Friends) == 'undefined') {
BT.App.ui.Friends = new BT.views.Friends();
}

xnakxx
25 Oct 2010, 11:07 AM
works great!!
thanks mikeyroy