jeudi 20 mars 2014

How to *select* tree node on load?

I have two trees that share the same store and data. Tree 1 has a context menu and when an action is clicked, it passes along the node as a parameter so I am able to get the nodes id by node.data.id; where "node" is the parameter. So I am trying to set that same node as Selected in Tree 2, which is essentially the same tree with the same data i.e id's, text etc, but as a separate component. the code i have so far is:



var node_id = node.data.id;//the id of node selected in tree1

var selectedNode = this.getTree2().getStore().getNodeById(node_id);

this.getTree2().getSelectionModel().select(selectedNode);



No errors but node in tree 2 doesnt show as selected.



any help is appreciated thanks




Aucun commentaire:

Enregistrer un commentaire