ExtJs: Tree: how to scroll directly to a specific element?

后端 未结 5 399
走了就别回头了
走了就别回头了 2021-01-07 08:03

I\'m looking for a way to scroll to a specific element in a Tree. Any idea how to do this ?

5条回答
  •  一向
    一向 (楼主)
    2021-01-07 08:46

    var path = tree.getSelectionModel().getSelectedNode().getPath('id');  
        //reload data,  
        tree.getLoader().load(tree.getRootNode(),function(treeNode){  
        //expand path and select node
        tree.expandPath(path,'id',function(bSucess,oLastNode){  
            tree.getSelectionModel().select(oLastNode);  
        });  
    },this); 
    

提交回复
热议问题