2
votes

I can't figure out, if the following is possible.

I do have a sencha touch carousel with items. At some point i would like to remove/destroy the carousel but NOT the items in that carousel.

As far as i know, remove and destroy both also destroy the items added to the carousel.

Any hints about solving the issue would be great.

1

1 Answers

3
votes

Remove methods accept an argument to prevent destruction of removed items. In your case, you'll probably want to use removeAll(false).

// save items (not needed, but you probably need to keep a reference for later use)
var items = carousel.getItems();

// empty the carousel before destroying it
carousel.removeAll(false); // destroy set to false

// now you can dispose of the carousel
carousel.destroy();

// then, you'll probably want to add your items to another container...
otherContainer.add(items);