阅读背景:

easyui tree后台传json处理问题

来源:互联网 

一、tree json格式

[
    {
        "id": 1,
        "text": "权限管理",
        "iconCls": "icon-feed",
        "checked": false,
        "attributes": {
            "url": "#123"
        },
        "children": [
            {
                "id": 2,
                "text": "用户管理",
                "iconCls": "icon-users",
                "checked": false,
                "attributes": {
                    "url": null
                },
                "state": null
                
            },
            {
                "id": 3,
                "text": "角色管理",
                "iconCls": "icon-users",
                "checked": false,
                "attributes": {
                    "url": null
                },
                "children": [
                    {
                        "id": 10,
                        "text": "角色管理1",
                        "iconCls": "icon-users",
                        "checked": false,
                        "attributes": {
                            "url": null
                        },
                        "state": null
                       
                    }
                ],
                "state": null
                
            },
            {
                "id": 4,
                "text": "菜单管理",
                "iconCls": "icon-users",
                "checked": false,
                "attributes": {
                    "url": "#222"
                },
                "state": null,
                "children":[]
               //注意这里的state值设置很关键,若为父节点,state="open"|"close",若为叶子节点,只能为空
               //否则出错,如图①
            }
        ]
        
    },
    {
        "id": 5,
        "text": "系统模块",
        "iconCls": "icon-feed",
        "checked": false,
        "attributes": {
            "url": null
        },
       "state": null 
    },
    {
        "id": 6,
        "text": "系统模块2",
        "iconCls": "icon-feed",
        "checked": false,
        "attributes": {
            "url": null
        }
        
    },
    {
        "id": 7,
        "text": "系统模块3",
        "iconCls": "icon-feed",
        "checked": false,
        "attributes": {
            "url": null
        }
        
    },
    {
        "id": 8,
        "text": "系统模块4",
        "iconCls": "icon-feed",
        "checked": false,
        "attributes": {
            "url": null
        }
        
    },
    {
        "id": 9,
        "text": "系统模块5",
        "iconCls": "icon-feed",
        "checked": false,
        "attributes": {
            "url": null
        }
        
    }
]
[
    {
        "id": 1,
  



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: