-
18 Feb 2013 9:33 AM #1
NodeInterface removeAll() removes related node data too early
NodeInterface removeAll() removes related node data too early
Hello again,
In 4.2.0.489 the NodeInterface.removeAll() function sets the previousSibling, nextSibling, and parentNode values of all childNodes to null before it fires the 'remove' event.
This causes a TreeStore.reload() call with a "node" specified in the options object to remove more nodes than it should when reloading a node with at least one child node and one grandchild node expanded. The issue is in NodeStore.onNodeRemove() when it calls onNodeCollapse(). onNodeCollapse() tries to figure out where the node is in the tree, and since it's parent and sibling nodes have already been set to null it just removes the rest of the tree.
Here is an example
If you click the "Test" button you will see that not only does Parent4 dissapear, but everything below it goes away as well.Code:Ext.create('Ext.tree.Panel', { dockedItems: [ { xtype: 'toolbar', dock: 'top', items: [ { xtype: 'button', text: 'Test', handler: function() { var me = this; var store = me.up('treepanel').getStore(); var item = store.getById('p4'); item.removeAll(); } } ] } ], store: Ext.create('Ext.data.TreeStore', { root: { text: 'Ext JS', id: 'root', expanded: true, children: [ { text: 'parent', id: 'p1', expanded: true, children: [ { text: 'Parent 4', id: 'p4', expanded: true, children: [ { text: 'Parent 3', id: 'p3', expanded: true, children: [ { text: 'Parent 2', id: 'p2', expanded: true, children: [ { leaf: true, text: 'child 1', id: 'p2c1' }, { leaf: true, text: 'child 2', id: 'p2c2' } ] } ] } ] }, { text: 'Parent 5', id: 'p5', expanded: true, children: [ { leaf: true, text: 'child 1', id: 'p4c1' }, { leaf: true, text: 'child 2', id: 'p4c2' } ] } ] } ] }, folderSort: true, sorters: [ { property: 'text', direction: 'ASC' } ] }), title: 'Tree Edge case Tester', useArrows: true })
The solution seems to be to not alter the nodes position in the tree until after it has been removed.
Hope that helps!
-
20 Feb 2013 1:03 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
Thanks for the report.
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.
You found a bug! We've classified it as
EXTJSIV-8756
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote