Treeview - 如何在 JSON 中默认选中节点?

Treeview - How to have nodes default checked in JSON?

对于 jonmiles treeview 插件,如何在 json 数据中定义默认检查某些节点?

以下完全忽略:

[{
        "text": "Parent 1",
        "checked": true,
        "nodes": [{
                "text": "Child 1",
                "nodes": [{
                        "text": "Grandchild 1"
                    },
                    {
                        "text": "Grandchild 2"
                    }
                ]
            },
            {
                "text": "Child 2"
            }
        ]
    },
    {
        "text": "Parent 2"
    },
    {
        "text": "Parent 3"
    },
    {
        "text": "Parent 4"
    },
    {
        "text": "Parent 5"
    }
]

它应该工作,如果你使用:

{
    "text": "Parent 1",
    "state": {
        "checked": true
    }
}

您忘记输入 state 属性。作为参考,请查看自述文件中的 data structure