jQuery MiniUI

 找回密码
 立即注册
查看: 602|回复: 1

在mini-treegrid中,如何加载json中节点data的数据? [复制链接]

Rank: 6Rank: 6

发表于 2020-3-24 06:57:18 |显示全部楼层
本帖最后由 joyoes 于 2020-3-24 07:01 编辑

我参考了http://miniui.com/demo/#src=treegrid/drawcell.html
的例子,发现从服务器端获取的json格式数据没有像total、msg之类的字段,而是直接加载列表数据,但如果服务器端返回的json数据带到这几个字段时,mini-treegrid要如何设置才能加载data字段下面的json数据啊?
比如服务器返回的json格式数据是:
{
msg:200,
total:100,
data:[{id:1,name:"张三"},{id:2,name:"李四"}]
}
而示例中返回的json格式是这样的:
  1. [{
  2.     "UID": "1",
  3.     "Name": "项目范围规划",
  4.     "Duration": 8,
  5.     "Start": "2007-01-01T00:00:00",
  6.     "Finish": "2007-01-10T00:00:00",
  7.     "PercentComplete": 0,
  8.     "Summary": 1,
  9.     "Critical": 0,
  10.     "Milestone": 0,
  11.     "PredecessorLink": [],
  12.     "ParentTaskUID": -1
  13. },
  14. {
  15.     "UID": "2",
  16.     "Name": "确定项目范围",
  17.     "Duration": 1,
  18.     "Start": "2007-01-01T00:00:00",
  19.     "Finish": "2007-01-01T23:23:59",
  20.     "PercentComplete": 30,
  21.     "Summary": 0,
  22.     "Critical": 0,
  23.     "Milestone": 0,
  24.     "PredecessorLink": [],
  25.     "ParentTaskUID": "1"
  26. }]
复制代码


Rank: 8Rank: 8

发表于 2020-3-24 13:22:58 |显示全部楼层
dataField="data" resultAsTree="false" idField="UID“ parentField="ParentTaskUID"
id/pid字段按你数据里面的对应字段来

Archiver|普加软件

GMT+8, 2020-12-2 10:34 , Processed in 0.027222 second(s), 10 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部