这是我在这个问题上苦苦挣扎的第二天,似乎没有人在使用 subgrid,或者我在这里撒尿。
这是我的网格代码:
jQuery("#gridTable").jqGrid({
url: ROOT + '/admin/station/getPagedList.json',
datatype: "json",
jsonReader : {
cell: "",
id: "0",
repeatitems: false,
// subgrid: {
// root:"rows",
// repeatitems: false,
// cell:"cell"
// }
},
colNames:['ID', 'Estação', 'Sigla', 'Linha', 'Lote', 'Empresa'],
colModel:[
{name:'id',index:'id', width:50, editable:false, hidden: true},
{name:'name',index:'name', width:130, editable:true},
{name:'acronym',index:'acronym', width:35, editable:true},
{name:'line.name',index:'line.name', width:130, editable:true},
{name:'line.lot.name',index:'line.lot.name', width:130, editable:false},
{name:'line.lot.company.name',index:'line.lot.company.name', width:130, editable:false},
],
subGrid : true,
subGridUrl: ROOT + '/admin/contact/getList.json',
subGridModel: [{
name : ['Nome','Contato'],
width : [150, 150]
}],
rowNum:30,
rowList:[30,50,75],
pager: '#pager',
sortname: 'name',
viewrecords: true,
imgpath: ROOT + '/css/jquery/cptm/images',
caption:'Estações',
height:"auto",
altRows:true,
altclass:"jqgrow-alt",
loadError : function(xhr,st,err) {
if (xhr.status.toString() == '901') {
jAlert('Sua sessão expirou.<br>Por favor efetue o login novamente.', 'AVISO', function(){
location.href = ROOT + "/logout";
});
}
},
});
我已经调整了子网格 URL 以返回 Json 的几个变化,但这是我得到的最远的:
{“行”:[{“细胞”:“0987654321”}]}
有人请帮助我。@Oleg,如果可以请看一下。