小编use*_*482的帖子

jstree:未捕获的TypeError:无法读取未定义的属性“子级”

在我的服务器中,我以jsTree的格式返回JSON对象:

{"id":"value", "text":"value", "parent":"value"} 
Run Code Online (Sandbox Code Playgroud)

我通过Ajax调用获得了它。Console.log向我显示了详细信息,但是jsTree给了我错误:

未捕获的TypeError:无法读取未定义的属性“子级”

视图:

$.ajax({
    url: "/category",
    dataType: 'json',
    type: 'GET',
    success: function (res) {
        $.each(res, function (i, obj) {
            products.push([obj.id, obj.parent, obj.text]);
            $('#jstree_demo_div').jstree({
                'core': {
                    'data': [{ "id": obj.id, "parent": obj.parent != 0 ? obj.parent : "#", "text": obj.text }]
                }
            });
            console.log(obj.parent != 0 ? obj.parent : "#");
        });

    }
});
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery jstree jstree-search

5
推荐指数
1
解决办法
7563
查看次数

Jstree:当我重新加载树时,我无法重置所有复选框以取消选中

我试着用这个:

$("#jstree_demo_div").jstree("destroy").empty();  
Run Code Online (Sandbox Code Playgroud)

它会删除已检查的节点并重新加载树,但不会应用新的更改.任何建议将不胜感激.

在全球范围内,我需要取消选中我的树 checkBox

javascript ajax jquery jstree jstree-search

3
推荐指数
1
解决办法
4089
查看次数

标签 统计

ajax ×2

javascript ×2

jquery ×2

jstree ×2

jstree-search ×2