easyui treegrid 控制节点展开等级 80
注:一级节点下可能有很多二级节点,二级节点下也可能有很多三级节点....,节点级数为5级,或许更多。
已解决,easyui有一个getLevel方法可以获得节点等级,利用这个方法很容易就实现了 展开
建议修改返回的json格式,不直接嵌套。而是采用父节点ID的方式。如:var treeData =[
{"id":"1200000100","parentId":"0","text":"苏州报表中心","staffId":"1200001016","level":"1","state":"closed"},
{"id":"1200000345","parentId":"1200000100","text":"周期报表","staffId":"1200001016","level":"2","state":"closed"},
{"id":"1200001245","parentId":"1200000100","text":"报表模板","staffId":"1200001016","level":"2","state":"closed"},
{"id":"1200001487","parentId":"1200000345","text":"创电中心","staffId":"1200001016","level":"3","state":"closed"},
{"id":"1200001540","parentId":"1200001245","text":"报表测"}]
根据前台根据parentId来生成tree.源码可参考我的博客:网页链接
2018-09-23 · 知道合伙人互联网行家
json就是正常的树表格json
[
{
"id": 1,
"name": "",
"date": "",
"begin": "",
"state":"closed",
"children": [
{
"id": 1003,
"name": "Name 1",
"date": "2018-8-8",
"begin": "2018-8-7",
"children": [
{
"id": 10673,
"name": "Name 1",
"date": "2018-8-8",
"begin": "2018-8-7"
}
]
}
]
}
]