JQuery Dynatree - search node by name

后端 未结 4 1748
清酒与你
清酒与你 2020-12-09 22:01

I would like to start using Dynatree on my page, however I will probably need searching my tree by name. Do you know maybe how to do this?

4条回答
  •  醉梦人生
    2020-12-09 22:29

    There is currently no search function, but you could use something like this (not tested)

    var match = null;
    tree.visit(function(node){
        if(node.data.title === "foo"){
            match = node;
            return false; // stop traversal (if we are only interested in first match)
        }
    });
    alert("Found " + match);
    

提交回复
热议问题