-
20 Nov 2012 7:55 AM #1
Tree collapse selects all children (performance issue)
Tree collapse selects all children (performance issue)
I have a tree with a terrible performance, profiling I saw that the function I have attached to the selectionchange event of the selection model is called tons of times when you collapse a node. I created a small test case for this, you can run it and check the console when the root is collapsed:
This is a performance killer if you have a function slightly more complex than the one I added in this code...Code:<html> <head> <title>ExtJS Example</title> <link rel="stylesheet" type="text/css" href="javascript/extjs/resources/css/ext-all.css"/> <script type="text/javascript" src="javascript/extjs/ext-all-debug.js"></script> <script type="text/javascript"> Ext.onReady(function() { var root = {text : 'root', children :[]}, counter = 0; for (var i = 0; i < 99; i++) { root.children.push({text : 'child'+i, leaf:true}); } Ext.create('Ext.container.Viewport', { layout: 'border', items: [ Ext.create('Ext.tree.Panel', { title : 'tree', region: 'west', split: true, width: 300, selModel : Ext.create('Ext.selection.RowModel', { listeners : { selectionChange : function() { counter++; console.log(counter); } } }), store : Ext.create('Ext.data.TreeStore', { root : root }) }) ] }); }); </script> </head> <body></body> </html>
I am the only one that found this? If this is not a bug, please explain the behavior and move the topic to the correct forum.
-
20 Nov 2012 1:26 PM #2
Thanks for the report! I have opened a bug in our bug tracker.
-
20 Nov 2012 2:47 PM #3
There's a couple of points here:
1) Trees should use selection.TreeModel. Currently it's not documented, but it needs to be and will be in future versions.
2) The selection model does need to check some extra stuff before firing events, which we'll fix up as well.
Thanks for the test case.Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
21 Nov 2012 12:09 AM #4
This really solved my problem, nevertheless, that class is marked as private:
NOTEThis is a private utility class for internal use by the framework. Don't rely on its existence.
I understand from there that it should not be used directly
About the second point, everything that can make software better is good news
Thanks for the quick support.
Cheers
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-7794
in
4.2.0.179.


Reply With Quote
