How to remove all children of a tree node
4. March 2009 – 23:34Suppose we want to remove all children of the node node:
while(node.firstChild) { node.removeChild(node.firstChild); }
That’s all there is to it
For good of all productive developers
Suppose we want to remove all children of the node node:
while(node.firstChild) { node.removeChild(node.firstChild); }
That’s all there is to it
12 Responses to “How to remove all children of a tree node”
are you the maker of the extjs wordpress template?
i like it and i see the features of 2.0?
is this still under development??
greets
By blablaman on Mar 8, 2009
No, I haven’t made Ext WordPress theme.
By Saki on Mar 9, 2009
Nice! I was looking for this, thanks.
By Edgar Meij on Mar 22, 2009
Awesome, really helped me, thanks!
By nadav on Mar 25, 2009
while(node.firstChild && node.firstChild.remove());
By TCL on Sep 1, 2009
Very interesting and informative site! Good job done by you guys, Thanks
By website designing pakistan on Jan 10, 2010
This works, thanks. Love your site!
By Sean on May 11, 2010
Just to bring to ppls attention, there\’s a new removeAll method on the tree node. Looks like its only in version 3.2 and not 3.1 (worked that out the hard way). removeChild also doesn\’t work in 3.1 but fixed in 3.2.
By Steve on May 31, 2010
Hi, I am trying to remove the nodes like in your example and than add them again. Firstly I have a memory leak after that, and also sometimes i have an awfull “this.target is null
error source line: [Break on this error] Ext.ToolTip=Ext.extend(Ext.Tip,{showDe…ithin(this.target.dom,true)){return;}” error );
By solovieff on Jul 12, 2010
Thanks mate, saved my day…
– Anish Sneh
By Anish Sneh on Jan 28, 2011
Ext.getCmp(\’treeid\’).getRootNode().removeAll();
By Farish on Jul 4, 2011
use without the backslash in the getCmp
By Farish on Jul 4, 2011