Skip to content

Instantly share code, notes, and snippets.

@iskugor
Created February 9, 2012 13:02
Show Gist options
  • Save iskugor/1779850 to your computer and use it in GitHub Desktop.
Save iskugor/1779850 to your computer and use it in GitHub Desktop.
Remove all child elements in Titanium
function removeAllChildren(viewObject){
//copy array of child object references because view's "children" property is live collection of child object references
var children = viewObject.children.slice(0);
for (var i = 0; i < children.length; ++i) {
viewObject.remove(children[i]);
}
}
@vaudevillejay
Copy link

You are a hero!

@shahdhiren
Copy link

Is it possible to remove all children views without animation?? Currently I am having 35 child views, and I have to remove all 35 child views and again I have to add those views with updates. It takes too much of visible time to Remove all child views and again adding those views.... Can you suggest some better ways of doing this??

@Yustoteles
Copy link

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment