jqGrid v4.3.2
ie9
win7enterprise
I'm using the following code to generate subgrids:
http://www.trirand.com/blog/jqgrid/jqgrid.html - > Advanced -> Grid as SubGrid
I do this and i have
1st level subgrid OK
2nd level subgrid OK
3rd level subgrid OK
4th level subgrid It loads the subgrid OK for every row of the 3rd Lvl sg, but it shows data only of the first row id of the 3rd Lvl sg
When I check the developer tools I see that the request always sends the id of the first row of the third subgrid, I know how to append custom parameters with postData which I have already tried and also this answer from Oleg K postData for subgrid in jqgrid not working? (this one doesn't work in my case, data is not added to the request)
I've tried to return the rowdid from the following events but no luck, it stills returns the first row id of the third subgrid and thus, for every row on the third subgrid the children subgrid always returns the same.
subGridRowExpanded //always returns first row id of the third grid
onSelectRow //doesn't fire if we click the + icon for expanding the subgrid
beforeSelectRow //doesn't fire at all
Another strange behaviour is that if i click any row on the third level subgrid it only selects the first row.
No, using treegrid is not an option, sorry.
I'm thinking of binding a click event on the plus icon (first cell) of each row of the 3rd level subgrid and fire a expandSubGridRow, but the question remains, how do I get the rowid of the row I clicked of the third level subgrid?
Best regards and thanks in advance, any help is much appreciated.
jQuery("#listsg11").jqGrid({
url:'server.php?q=1',
datatype: "xml",
height: 190,
colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
colModel:[
{name:'id',index:'id', width:55},
{name:'invdate',index:'invdate', width:90},
{name:'name',index:'name', width:100},
{name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false}
],
rowNum:8,
rowList:[8,10,20,30],
sortname: 'id',
viewrecords: true,
sortorder: "desc",
multiselect: false,
subGrid: true,
caption: "Grid as Subgrid",
subGridRowExpanded: function(subgrid_id, row_id) {
var subgrid_table_id;
subgrid_table_id = subgrid_id+"_t";
$("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>");
jQuery("#"+subgrid_table_id).jqGrid({
url:"subgrid.php?q=2&id="+row_id,
datatype: "xml",
colNames: ['No','Item','Qty','Unit','Line Total'],
colModel: [
{name:"num",index:"num",width:80,key:true},
{name:"item",index:"item",width:130},
{name:"qty",index:"qty",width:70,align:"right"},
{name:"unit",index:"unit",width:70,align:"right"},
{name:"total",index:"total",width:70,align:"right",sortable:false}
],
subGrid: true,
caption: "Grid as Subgrid",
subGridRowExpanded: function(subgrid_id2, row_id2) {
var subgrid_table_id2;
subgrid_table_id2 = subgrid_id2+"_t";
$("#"+subgrid_id2).html("<table id='"+subgrid_table_id2+"' class='scroll'></table>");
jQuery("#"+subgrid_table_id2).jqGrid({
url:"subgrid.php?q=3&id="+row_id2,
datatype: "xml",
colNames: ['No','Item','Qty','Unit','Line Total'],
colModel: [
{name:"num",index:"num",width:80,key:true},
{name:"item",index:"item",width:130},
{name:"qty",index:"qty",width:70,align:"right"},
{name:"unit",index:"unit",width:70,align:"right"},
{name:"total",index:"total",width:70,align:"right",sortable:false}
],
subGrid: true,
caption: "Grid as Subgrid",
subGridRowExpanded: function(subgrid_id3, row_id3) {
var subgrid_table_id3;
subgrid_table_id3 = subgrid_id3+"_t";
$("#"+subgrid_id3).html("<table id='"+subgrid_table_id3+"' class='scroll'></table></div>");
jQuery("#"+subgrid_table_id3).jqGrid({
url:"subgrid.php?q=4&id="+row_id3,
datatype: "xml",
colNames: ['No','Item','Qty','Unit','Line Total'],
colModel: [
{name:"num",index:"num",width:80,key:true},
{name:"item",index:"item",width:130},
{name:"qty",index:"qty",width:70,align:"right"},
{name:"unit",index:"unit",width:70,align:"right"},
{name:"total",index:"total",width:70,align:"right",sortable:false}
]
});
}
});
}
});
}
});