Hi,
I'm looking for a way to scroll to a specific element in a Tree. Any idea how to do this ?
Hi,
I'm looking for a way to scroll to a specific element in a Tree. Any idea how to do this ?
It isn't directly related to extJs, but you could get the DOM element you want in your tree and use scrollTo
to get to it.
Try this in your node click event handler:
node.getUI().getIconEl().scrollIntoView(node.getOwnerTree(), false);
I just had to call n.select();
but I had to do it in the right place :)
I made a TreeLoader, and linked it to my tree. In its event load
(which means 'when all is downloaded', I would have called it afterload
...), I read all the nodes and depending on their id
I act consequently:
var LasTreeLoader = new Ext.tree.TreeLoader({
dataUrl: 'json/las.php',
listeners: {
load: function(loader,n,response) {
console.log('datas downloaded');
n.eachChild(
function(n) {
if ((n.id=='las/2007') ||
(n.id=='las/2007/08') ||
(n.id=='las/2007/08/29')) {
n.expand(false,false);
}
if (n.id=='las/2007/08/29/21_14_04') {
n.select();
}
});
}
}
});