I'm trying to sync a dataview (explorer window) with a tree (directory tree). When I click on an element on my dataview, I'd like the same node gets selected on the tree
The problem is that using the
tree.getSelectionModel().select(index)
doesn't allow me to select the node by its internal id (the id I provided in my treestore), but only by the record index...
So I just can't sync both views...
There would be the solution of the expandPath(), but my treestore is fed by a relational database (id,name,parent_id etc..), so finding the full path is(or could be) a heavy load for the server (I'd like to avoid to have to provide any path...).
Basically I would like to be able to say "expand the node where the "id= " (or any other key/value of the treestore).
Is it possible ? Is there any workaround ?
Thank you for reading me !
The tree.getSelectionModel().select(record) function can accept a record instance instead of an index. I would do something like this:
var record = tree.getRootNode().findChild('id_name','record_id',true);
tree.getSelectionModel().select(record);
for more info on the findChild function, check out the NodeInterface docs here: http://docs.sencha.com/ext-js/4-0/#/api/Ext.data.NodeInterface-method-findChild
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With