PDA

View Full Version : Reload carousel items



marimaf
14 Jun 2011, 2:47 PM
I need to reload the items from my carousel (I clicked on an item and a panel gets destroyed, then when I try to go back, I need to rebuild the carousel)

For this I am removing the items of the carousel by doing:

var len = cards.length;
for(var c = 0; c < len;c++)
this.myCarousel[0].items.remove(cards[0]);

then I set the cards again and set the carousel items again:


this.myCarousel[0].items.append(cards);
this.doLayout();

but after doing this, the cards dont get set right, they just get written on top of each other, no carousel effect gets done. Also the cards start being drawn under the carousel's toolbar, instead of starting below the toolbar.

The first time when I load the cards it works perfectly (when I build the carousel from scratch), but if I delete the previous cards and add them again, they don't get displayed properly, I hope someone can help me.

Thank you in advance

bclinton
14 Jun 2011, 7:59 PM
It sounds like the items are being destroyed. Try using the second parameter of the remove method:


remove( Component/String component, [Boolean autoDestroy] ) : Ext.Component

autoDestroy : Boolean
(optional) True to automatically invoke the removed Component's Ext.Component.destroy function. Defaults to the value of this Container's autoDestroy config.