首页 > Web开发 > 详细

jstree高级使用,获取所有选中的值并且所有待选的父级结点值

时间:2014-12-09 17:20:49      阅读:850      评论:0      收藏:0      [点我收藏+]
var tree = $("#jstree").jstree({
        "core": {
            "themes": { "responsive": false },
            "check_callback": true,
            ‘data‘: { ‘url‘: function (node) { return ‘/test/jstreejson‘; }, ‘data‘: function (node) { return { ‘parent‘: 1000 }; } }
        },
        "types": {
            "default": { "icon": "fa fa-folder icon-state-warning icon-lg" },
            "file": { "icon": "fa fa-file icon-state-warning icon-lg" }
        },
        //"state": { "key": "demo3" },
        ‘plugins‘: [ "checkbox", "types"]
    }).on("changed.jstree", function (e, data) {
      //改变事件
    }).bind("select_node.jstree", function (e, data) {
    //选中事件
    });

   //获取所有选中的值,并且获取待选的父级值
    function ttt() {
        var idArray = new Array();
        $("#jstree").find(".jstree-checked, .jstree-undetermined ").each(function () {
            idArray.push($(this).closest(‘li‘).attr("id"));
        });
        idArray = idArray.concat($.jstree.reference($("#jstree")).get_selected());
        alert(idArray.join(‘,‘));
    }


做网站,做软件可以找
天马网站建设http://www.tmddd.com/



 

jstree高级使用,获取所有选中的值并且所有待选的父级结点值

原文:http://www.cnblogs.com/stao/p/4153437.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!