Looks like we can't reproduce the issue or there's a problem in the test case provided.
-
Sencha User
[4.2.0] Treepanel behaving really strange on appending a child with children included
REQUIRED INFORMATION
Ext version tested:
Browser versions tested against:
- Firefox 19.0.2
- Chrome 25.0.1364.172
Description:
- The treepanel acts really strange, when adding an object with children (rendering the children inside AND outside of the parent node, duplicating them on collapse/expand of the parent node)
Steps to reproduce the problem:
The result that was expected:
- having the child nodes once under the parent node, even after collapse/expand
The result that occurs instead:
- the child nodes are rendered as child of the parent node AND as child of the root node
- on collapse/expand of the parent node, the child nodes are dpulicated
Test Case:
Code:
var view = Ext.create('Ext.tree.Panel',
{
renderTo: Ext.getBody(),
root: {
text: "root",
expanded: true
},
rootVisible: false,
height: 500
});
view.getRootNode().appendChild({
id: 33,
text: "Preise",
children: [
{
id: 66,
text: "Featurepreise",
leaf: true,
expanded: true
},
{
id: 67,
text: "Produktpreise",
leaf: true,
expanded: true
}
],
expanded: true
});
HELPFUL INFORMATION
Screenshot or Video:
See this URL for live test case:
http://alexdelius.com/testcase/index.html
Possible fix:
- Bug seems to be in Ext.data.TreeStore in method onBeforeNodeExpand. changing "delete data[reader.root];" to "delete (node.raw || node[node.persistenceProperty])[reader.root];" solved the problem for me.
- see http://alexdelius.com/testcase/fixed.html
Additional CSS used:
Operating System:
-
Thanks for the report! I have opened a bug in our bug tracker.
-
-
Sencha User
Is there a workaround for this basic function that's broken?
-
Hi @jchau,
Seems, @JTRipper suggests something in the "Possible fix" section. Have you tried it?
-
Just a note.
If expand nodes in a TreeStore's load listener, the issue can appear.
Adding a small delay for a load listener helps.