当前位置: 动力学知识库 > 问答 > 编程问答 >

ajax - jqgrid grid columns to subgrid

问题描述:

I have the following code which works fine and creates the grid with 4 columns:

 $("#"+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');

})

This code have no subgrids.

Is it posible to edit this, so the grid will have only columns 'id' and 'listname', and on subgrid are 'customer','employee','sum'.

Does subgrid needs another ajax call?

I read that the following lines should be added

subGrid: true,

subGridRowExpanded: function (subGridId, rowId) {}

网友答案:

http://trirand.com/blog/jqgrid/jqgrid.html see grid as subgrid demo, it is in the advanced tab.

分享给朋友:
您可能感兴趣的文章:
随机阅读: