我需要一些有關如何在以下sceaniro中實現(xiàn)子網(wǎng)格的想法。以下是我想在JQuery Grid和Subgrid中顯示的json數(shù)據(jù)?;旧?,我得到了一個名為“ Contact”的對象,該對象具有一個名為“ actionSet”的集合。{ "total" : "10", "page" : "1", "records" : "78", "rows" : [ { "comment" : null, "givenName" : "Contact A", "familyName" : "A", "actionSet" : [ { "actionID" : 1, "actionDueDate" : "2012-12-08", "actionNote" : "Action 1" }, { "actionID" : 2, "actionDueDate" : "2012-12-08", "actionNote" : "Action 2" } ] } ...]}我希望每個網(wǎng)格行都顯示“聯(lián)系人”,并且與網(wǎng)格關聯(lián)的子網(wǎng)格應顯示“ actionSet”集合。當選擇了網(wǎng)格中的特定行時,我不想進行服務器調(diào)用以獲取關聯(lián)的動作,因為它們已經(jīng)存在于“ actionSet”中。我已經(jīng)使Grid正常工作,很好地顯示了“ Contacts”,但是在實現(xiàn)子網(wǎng)格時,由于如何獲取其數(shù)據(jù)而感到困惑,因為它已經(jīng)可以在json中使用了。jq(function() { jq("#grid").jqGrid({ url:'/smallworks/project/getall.do', datatype: 'json', mtype: 'GET', colNames:['Id', 'First Name', 'Last Name'], colModel:[ {name:'id',index:'id', width:55,editable:false,editoptions: {readonly:true,size:10},hidden:true}, {name:'givenName',index:'givenName', width:100,editable:true, editrules:{required:true}, editoptions:{size:10}}, {name:'familyName',index:'familyName', width:100,editable:true, editrules:{required:true}, editoptions:{size:10}} ], postData: { }, rowNum:20, rowList:[20,40,60], height: 200, autowidth: true, rownumbers: true, pager: '#pager', sortname: 'id', viewrecords: true, sortorder: "asc", caption:"Contacts", emptyrecords: "Empty records", loadonce: false, loadComplete: function() { },這可以實現(xiàn)嗎?我是否需要專門為子網(wǎng)格解析JSON數(shù)據(jù)?如何做到這一點?
- 3 回答
- 0 關注
- 635 瀏覽
添加回答
舉報
0/150
提交
取消