JSTree如何实现第二级菜单异步从数据库读取。
2024-09-11 14:54:06
参考文档:
https://www.cnblogs.com/luozhihao/p/4679050.html
http://jsfiddle.net/vakata/2kwkh2uL/5/
核心的关键点是:
组装节点的children元素时,设置 children = true
$('#jstree_company').jstree({
"core": {
"animation": 0,
"check_callback": true,
"themes": { "stripes": true },
'data': {
'url': function (node) {
return '/IS/CDictionary/GetDictionTree';
},
'data': function (node) {
return { 'id': node.id,'type':'company' };
}
}
},
"plugins": ["contextmenu", "dnd"],
});
组装的后台代码:
JSTree treeFlow = new JSTree()
{
id = item.DictID.ToString(),
parent = id,
text = item.Title,
state = new NodeState() { opened = false },
children = true
};
trees.Add(treeFlow);
最新文章
- java打包文件夹为zip文件
- Python:迭代器
- Tortoise SVN 更换用户
- linux xargs 使用
- Ubuntu里字符编码设置
- error C2664: “UINT GetDriveTypeW(LPCWSTR)”: 无法将参数 1 从“char [5]”转换为“LPCWSTR”
- Example001使用window对象打开窗口
- vue入坑总结
- js中的typeof和instanceof和===
- android 小项目------黑名单app
- H5 基于Web Storage 的客户端留言板
- 在阿里云开源镜像站中下载centOS7
- 【转】HTTP
- 账户和联系人 Accounts and Contacts 译
- Hbase记录-ZooKeeper API
- 第二阶段——个人工作总结DAY01
- .Net 垃圾回收和大对象处理 内存碎片整理
- sqlserver2008debug存储过程
- spring冲刺第八天
- 你知道吗?10个精妙的 Java 编码最佳实践