我有一个treepanel
和一个扩展树并选择一个特定节点的过程。问题是 - 我不知道如何滚动到这个节点,以便它变得可见。我尝试这两种方法,我已经看到了在计算器和其他论坛:无法滚动到树节点
1.
tree.getSelectionModel().select(node);
tree.getView().focusRow(node);
2.
location.hash=node.data.id;
我有一个treepanel
和一个扩展树并选择一个特定节点的过程。问题是 - 我不知道如何滚动到这个节点,以便它变得可见。我尝试这两种方法,我已经看到了在计算器和其他论坛:无法滚动到树节点
1.
tree.getSelectionModel().select(node);
tree.getView().focusRow(node);
2.
location.hash=node.data.id;
在此请看:http://jsfiddle.net/slemmon/P9TkZ/3/。 您可能需要使用的selectionModel的,而不是tree.selectPath:
tree.selectPath('/Root/path/to/your/node', 'text', '/', function (s, n) {
var nodeEl = Ext.get(tree.view.getNode(n));
nodeEl.scrollIntoView(tree.view.el, false, true);
});
使用selectPath method
tree.selectPath(node.getPath())