为了账号安全,请及时绑定邮箱和手机立即绑定

JQuery Grid-SubGrid用于父子关系

JQuery Grid-SubGrid用于父子关系

胡说叔叔 2019-11-04 09:44:02
我需要一些有关如何在以下sceaniro中实现子网格的想法。以下是我想在JQuery Grid和Subgrid中显示的json数据。基本上,我得到了一个名为“ 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"  } ] }    ...]}我希望每个网格行都显示“联系人”,并且与网格关联的子网格应显示“ actionSet”集合。当选择了网格中的特定行时,我不想进行服务器调用以获取关联的动作,因为它们已经存在于“ actionSet”中。我已经使Grid正常工作,很好地显示了“ Contacts”,但是在实现子网格时,由于如何获取其数据而感到困惑,因为它已经可以在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() {  },这可以实现吗?我是否需要专门为子网格解析JSON数据?如何做到这一点?
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 564 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信