[CLOSED] Select node after expand in TreePanel
Good evening, I'm trying select a TreePanel's leaf after expand node (load ondemand) with this function:
Code:
var SelectNode = function (path, serial) {
var tree = Ext.getCmp("treeArchivi"),
sm = tree.getSelectionModel(),
node = tree.store.getNodeById(serial);
if (node == undefined) {
tree.expandPath(path);
}
node = tree.store.getNodeById(serial);
console.log(node);
if (node != undefined) {
sm.select(node);
App.direct.OpenArchivio(formatSerial(serial), node.data.text);
}
};
but console.log(node); returns undefined.
How can I resolve this issue?
Thanks in advance