我有两个jqgrids。其中一个列出了一些组,当我点击任何组时,其子列表位于第二个网格。第一个网格运行良好,但第二个网格没有。第二个网格的数据是这样的:
{"devices":[{"type":"AAA","username":"username_0","password":"password_0","name":"devicename_0","description":"description","identity":null,"version":0,"systemId":0,"active":true}],"numberOfDevice":1,"name":"groupname_0","systemId":0,"active":true}
那部分将成为我的第二个网格来源:
{"type":"AAA","username":"username_0","password":"password_0","name":"devicename_0","description":"description","identity":null,"version":0,"systemId":0,"active":true}
可能有更多设备(它们位于设备组下)但此示例中只有一个设备。如何在我的jqgrid中使用该数据?
答案 0 :(得分:0)
您应该使用以下jsonReader
:
jsonReader: {
root: 'devices',
repeatitems: false,
page: function () { return 1; },
total: function () { return 1; },
records: function (obj) { return obj.devices.length; }
}
请参阅the demo。