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:
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>
This is a performance killer if you have a function slightly more complex than the one I added in this code...
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.