展开动态树中节点的父节点

expand the parents of a node in dynatree

本文关键字:节点 父节点 动态      更新时间:2023-09-26

我想根据给定节点找出dynatree中的所有父节点并展开父节点。

function Expand(node){
  $(".dynatree-node").each(function(){
        if($(this).text() == node){
            node.visitParents( function (node) {
                   node.toggleExpand();
                },true); 
        }
    });
}

我做错了什么?如何继续?

node. makvisible ()将展开父节点

Try

$("..dynatree-node").each(function(){
    var node = $.ui.dynatree.getNode(this);
     node.getParent().expand(true);     
});