我有以下代码可以正常工作并创建包含4列的网格:
$("#"+GRID).jqGrid({
url:'ajax.htm',
datatype: 'json',
mtype: 'POST',
jsonReader: { repeatitems : false, cell:"", id: "id", userdata: "jsonModel", root: "rows" },
postData: {
ajaxRequest: document.helper.getPageName(),
screenMode: 'getList'
},
colNames:[
'id'
'listname',
'customer'.
'employee'.
'sum'
],
colModel:[
{name:'id', index:'id', editable:false, hidden: true},
{name:'listname', index:'id', editable:false, hidden: true},
{name:'customer', index:'customerColumn', editable:false, sortable:true},
{name:'employee', index:'employeeColumn', editable:false, sortable:true},
{name:'sum', index:'sum', editable:false, sortable:true}
],
autowidth:true,
shrinkToFit:true,
rownumbers:true,
pager:$('#'+GRID_PAGER),
sortname: 'listname',
sortorder: "desc",
loadonce: true,
rowNum:30,
rowList:[10, 30, 50],
viewrecords:true,
gridComplete:function () {
var data = $("#"+GRID).getGridParam('userData');
})
此代码没有子网格。
是否可以编辑此内容,因此网格只包含'id'
和'listname'
列,而子网格上只有'customer','employee','sum'
。
subgrid是否需要另一个ajax调用?
我读到应该添加以下行
subGrid:是的, subGridRowExpanded:function(subGridId,rowId){}