PDA

View Full Version : List removed from parent's items when tapped?



estesbubba
6 Dec 2010, 9:44 AM
I have a menu implemented as an Ext.List which is shared by all the cards of my application. When a card is requested, the controller checks to see if it exists. If it does it sets the active item. If it doesn't, it creates it and sets the active item. Each card's items look like:

items: [content, sharedMenu]

The first time in it works great. The second time it appears the sharedMenu has been removed from the items but content is still there. Does a List automatically remove itself from the parent's items when selected? I've been playing around with all kinds of properties with no luck. I can re-add the menu each time but that seems like a hack.

estesbubba
6 Dec 2010, 11:22 AM
So some debugging shows that an item can only belong to a single container. Here is the code for Ext.lib.Container:


onBeforeAdd : function(item) {
if (item.ownerCt) {
item.ownerCt.remove(item, false);
}

if (this.hideBorders === true){
item.border = (item.border === true);
}
},


So, if I have a menu (Ext.List) that I want shared between all my cards, how should I do it? Do I really need to create a new menu for every card?