jstree 的基本数据结构是{
attributes: { id : "node_identificator", some-other-attribute : "attribute_value" },
data: "node_title",
// Properties below are only used for NON-leaf nodes
state: "closed", // or "open"
children: [ /* an array of child nodes objects */ ]
} attributes里为自定义属性,data为节点显示的文本,state值为closed时,节点前面有表示节点可以被展开的标识。还有其它写法可参考documentation.html里的Datastores段。 jstree 是动态加载子节点的
所以,你的表除了满足基本数据的存储外,至少还需要有一个指示条目归属的字段
attributes: { id : "node_identificator", some-other-attribute : "attribute_value" },
data: "node_title",
// Properties below are only used for NON-leaf nodes
state: "closed", // or "open"
children: [ /* an array of child nodes objects */ ]
} attributes里为自定义属性,data为节点显示的文本,state值为closed时,节点前面有表示节点可以被展开的标识。还有其它写法可参考documentation.html里的Datastores段。 jstree 是动态加载子节点的
所以,你的表除了满足基本数据的存储外,至少还需要有一个指示条目归属的字段
比如存在:电脑、办公 > 电脑整机 > 超极本,数据库可以存3条数据1 0 1 电脑、办公
2 1 1,2 电脑整机
3, 2 1,2,3 超极本
只需提供父节点的 id 即可,而查询得到的只是该父节点的一级子节点