读书人

jquert easyUI combotree解决思路

发布时间: 2012-08-11 20:50:31 作者: rapoo

jquert easyUI combotree
怎么将后台传过来的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"        }]    }]}] 

读书人网 >J2EE开发

热点推荐