If you use subgrid as a grid , you need to create a new grid inside the subGridRowExpanded . The callback receives rowid as a parameter. Therefore, if you get an array of data that can be used as the data parameter for the subnet, the subgrade can be defined using datatype: 'local' .
The code diagram might be something like this:
var mainGridData = [ {id: 'm1', ...}, {id: 'm2', ...}, ], subgridData1 = [ {id: 's11', ...}, {id: 's12', ...}, ], subgridData2 = [ {id: 's21', ...}, {id: 's22', ...}, ], subgridByMainGridId = { m1: subgridData1, m2: subgridData2 }; $('#mainGrid').jqGrid({ datatype: 'local', data: mainGridData, .... subGrid: true, subGridRowExpanded: function(subgridId, rowId) { var subgridTableId = subgridId + "_t"; $("#" + $.jgrid.jqID(subgridId)).html('<table id="' + subgridTableId + '"></table>'); $("#" + $.jgrid.jqID(subgridTableId)).jqGrid({ datatype: 'local', data: subgridByMainGridId[rowId], ... }); });
Oleg Feb 06 '12 at 19:27 2012-02-06 19:27
source share