jstree添加复选框插件导致Uncaught TypeError: Cannot read property '

jstree adding checkbox plugin causes Uncaught TypeError: Cannot read property 'selected' of undefined

本文关键字:Cannot read property TypeError Uncaught 复选框 添加 插件 jstree      更新时间:2023-09-26

我使用jstree jquery插件来构建一个树,在3个不同的级别有~330个节点。

当我添加复选框插件来为每个树节点添加复选框时,我收到错误:

Uncaught TypeError: Cannot read property 'selected' of undefined.

设置为显示树的div只显示一个Loading消息。

$(document).ready(function() {
    buildTreeJson((testTree) => {
        $(function() {
            $('#jstreetest').jstree({
                "core": {
                    "data": testTree,
                    "themes": {
                        "variant": "large"
                    }
                },
                "checkbox": {
                    "keep_selected_style": false
                },
                "plugins": ["themes", "checkbox", "changed"]
            });
        });
    });
...

删除复选框插件我没有问题

就像OP一样,我发现我的数据循环导致了这个:

很抱歉延迟,这是数据循环的问题忽视。