Fork me on GitHub 文档链接
属性示例

contextmenuList

indent

方法示例
el2.updateKeyChildren(22,[
    {
        id: 23,
        label: "濉溪县1",
        disabled: true
    }
]);
el2.updateKeySelf(22,{
    label: "淮北市1",
    disabled: true
})
console.log(el2.getChecked(true,false));
el2.setChecked([12],true)
el2.unCheckNodes();
el2.unCheckArrNodes(22,24);
el2.expandAll();
el2.unExpandAll();
el2.expandNode(10);
el2.unExpandNode(10);
el2.toggleExpandNode(10);
el2.remove(23);
el2.remove(24);
el2.append(23,{
    id: 26,
    label: "烈山区",
    disabled: true
})
el2.insertBefore(24,{
    id: 26,
    label: "烈山区",
    disabled: true
})
el2.insertAfter(1,{
    id: 26,
    label: "烈山区",
    disabled: true
})
 el2=el2.reload({data: data});
getAllNodeData: function() {
    console.log(el2.getAllNodeData())
}
事件示例

请在触发动作时查看控制台数据

懒加载示例
var el4=eleTree.render({
    elem: '.ele4',
    data: [
        {
            "id": 1,
            "label": "安徽省"
        },
        {
            "id": 11,
            "label": "江苏省"
        }
    ],
    showCheckbox: true,
    lazy: true,
    load: function(data,callback) {
        console.log(data);
        var newData;
        switch (data.id) {
            case 1:
                newData=[
                    {
                        "id": 2,
                        "label": "马鞍山市"
                    }
                ]
                break;
            case 2:
                newData=[
                    {
                        "id": 3,
                        "label": "和县",
                        "isLeaf": true
                    }
                ]
                break;
            case 11:
                newData=[
                    {
                        "id": 12,
                        "label": "苏州市",
                        "disabled": true,
                        "isLeaf": true
                    }
                ]
                break;
        
            default:
                break;
        }
        setTimeout(function() {
            callback(newData);
        },500);
        
    }
});
下拉选择

//--------------------------------------------------------- // 对应的js var el5; $("[name='title']").on("click",function (e) { e.stopPropagation(); if(!el5){ el5=eleTree.render({ elem: '.ele5', data: data, defaultExpandAll: true, expandOnClickNode: false, highlightCurrent: true }); } $(".ele5").toggle(); }) eleTree.on("nodeClick(data5)",function(d) { $("[name='title']").val(d.data.currentData.label) $(".ele5").hide(); }) $(document).on("click",function() { $(".ele5").hide(); })
节点搜索


//--------------------------------------------------------- // 对应的js $(".eleTree-search").on("change",function() { el6.search($(this).val()); }) var el6=eleTree.render({ elem: '.ele6', data: data, showCheckbox: true, defaultExpandAll: true, defaultCheckedKeys: [23,24], searchNodeMethod: function(value,data) { if (!value) return true; return data.label.indexOf(value) !== -1; } });