ExtJs:Tree:如何直接滚动到特定元素? [英] ExtJs: Tree: how to scroll directly to a specific element?
本文介绍了ExtJs:Tree:如何直接滚动到特定元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一种滚动到树中特定元素的方法。
任何想法如何做?
I'm looking for a way to scroll to a specific element in a Tree. Any idea how to do this ?
推荐答案
我只需要调用 n.select ();
,但我必须在正确的地方做到:)
I just had to call n.select();
but I had to do it in the right place :)
我做了一个TreeLoader,并将其链接到我的树。在加载
(这意味着全部下载)的情况下,我会调用它 afterload
...)我读了所有的节点,根据他们的 id
我的行为:
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();
}
});
}
}
});
这篇关于ExtJs:Tree:如何直接滚动到特定元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文