-
17 Nov 2012 11:23 AM #1
How to delete a node off the tree?
How to delete a node off the tree?
This shouldn't be that hard, should it? I need to search through the store to find nodes that meet a certain criteria, and simply delete them (be they leaves or branches)?
Here's what I've got:
It's throwing a "childNodes[i] is undefined" error: childNodes[i].cascadeBy(fn, scope, args); [ext-all-dev.js (line 56625)]Code:var store = tree.getStore();store.doOnLoad(function(store) { var root = Ext.valueFrom(null, tree.getRootNode()); root.cascadeBy(function(node) { if (node.get("archived") == true) { store.getById(node.internalId).remove(); } }); });
Since it's throwing that inside a recursion loop, it would seem to indicate that it doesn't know to not follow that branch when its ancestor has been deleted. But that's only a guess at this point.
Been beating my head against the wall for far too long on this one. Any help would be greatly appreciated.
-
19 Nov 2012 10:22 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
You need to use the removeChild method on the parent node
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote