PDA

View Full Version : How to multi select nodes in TreePanel with MultiSelectionModel



red_exp
25 Aug 2010, 7:05 AM
Hello!

I can't programmatically select multiple nodes in TreePanel.
Here code

{
xtype: 'treepanel',
id: 'myTree',
selModel: new Ext.tree.MultiSelectionModel(),
listeners: {
click: function(node){
var sm = Ext.getCmp('myTree').getSelectionModel();
node.eachChild(function(item){
sm.select(item, true);
});
}
}
First: sm.select() unselect all already existing selections, even with keepExisting = true
Second: After the click all already existing selections also unselect

The second problem could be solved if there was an afterclick event, but it doesn't exist.

There must be some sort of solution to programmatically multi select nodes.

red_exp
25 Aug 2010, 10:06 PM
First solved with sm.select(item, 'click', true);
Second with setTimeout()