jquert easyUI combotree解决思路
jquert easyUI combotree
怎么将后台传过来的json中的 name 字段里的值加载到combotree的 text 里?
------解决方案--------------------
jquery easyui的combotree的数据源要求指定格式属性的,你可以在后台将json转化成它需要的格式,或者到前台页面上用js重新组装成它需要的格式即可。
下面是它要求的格式,json数组,text就是显示值,children字节点
怎么将后台传过来的json中的 name 字段里的值加载到combotree的 text 里?
------解决方案--------------------
jquery easyui的combotree的数据源要求指定格式属性的,你可以在后台将json转化成它需要的格式,或者到前台页面上用js重新组装成它需要的格式即可。
下面是它要求的格式,json数组,text就是显示值,children字节点
- JScript code
[{ "id":1, "text":"Folder1", "iconCls":"icon-ok", "children":[{ "id":2, "text":"File1", "checked":true },{ "id":3, "text":"Folder2", "state":"open", "children":[{ "id":4, "text":"File3", "attributes":{ "p1":"value1", "p2":"value2" }, "checked":true, "iconCls":"icon-reload" },{ "id": 8, "text":"Async Folder", "state":"closed" }] }] }]