jstree级联查找树

<script >
obj=$.jstree.reference($('#plugins4'));
function PP(obj,e,filename){
    if (obj.get_parent(e)=="#"){
        filename="/"+filename;
        return filename
    }
    else{
        filename=obj.get_node(obj.get_parent(e)).text+'/'+filename;
        return PP(obj,obj.get_parent(e),filename);
    }
    
};

var pathlist = new Array();

obj.get_selected().forEach(
    function(e){
        console.info(e);
        if (obj.get_children_dom(e).length==0){
                var filename=obj.get_node(e).text;
                console.log("filename"+filename);
                var a=''
                a=PP(obj,e,filename);
                console.info('>>>a>>>'+a)
                //console.info(a);
                pathlist.push(a)
            }
        }
)
;

</script>

  

posted @ 2016-06-12 16:39  similarface  阅读(710)  评论(0编辑  收藏  举报