Я использую подсетку для jqgrid. Это 1 уровень. Ниже приведен мой код. Я не знаю, что я делаю здесь не так. Но он передает значения в этом формате
_search = ложь & й = 1303143441927 & строк = 20 & страница = 1 & sidx = & ID = Sord по возрастанию
вместо
{ "_ поиск" ложь "й": 1303142903678 "строки": 100, "страница": 1, "sidx": "", "Sord": "по возрастанию"}
формат JSON.
$('#OrderGrd').jqGrid({
url:'/AdvertiserCenter/CategoryLead.ashx?action=getOrderData&advertiserID=' + $('#advertiser_id').text() + '&startDate=' + $('input[id$="ViewFromCal_CalendarTbx"]').val() + '&endDate=' + $('input[id$="ViewToCal_CalendarTbx"]').val(),
datatype: 'json',
mtype: 'POST',
height:'100%',
width:'100%',
colNames: ['Order Number','Payment Type','Cost','Status','Total'],
colModel: [{ name: 'order_number', index: 'order_number',align:"center",width:'80px',sortable:false},
{ name: 'payment_type', index: 'payment_type',width:'110px',align:"left",sortable:false},
{ name: 'cost', index: 'cost',width:'200px',align:"right",sortable:false},
.................
subGrid: true,
subGridRowExpanded: function(subgrid_id, row_id) {
var subgrid_table_id, pager_id;
var rowdata = jQuery('#OrderGrd').getRowData(row_id);
var orderid = rowdata.order_number;
subgrid_table_id = subgrid_id+'_t';
pager_id = 'p_'+subgrid_table_id;
$('#'+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+pager_id+"' class='scroll'></div>");
$.extend($.jgrid.defaults,
{ datatype: 'jsonstring' },
{ ajaxGridOptions: { contentType: "application/json",
success: function (data, textStatus) {
if (textStatus == "success") {
var thegrid = $('#'+subgrid_table_id)[0];
thegrid.addJSONData(data.data);
thegrid.grid.hDiv.loading = false;
switch (thegrid.p.loadui) {
case "disable":
break;
case "enable":
$("#load_" + thegrid.p.id).hide();
break;
case "block":
$("#lui_" + thegrid.p.id).hide();
$("#load_" + thegrid.p.id).hide();
break;
}
}
} //end of success
}//end of ajaxGridOptions
});// end of extend
jQuery('#'+subgrid_table_id).jqGrid({
url:'/AdvertiserCenter/CategoryLead.ashx?action=getOrderDetails&advertiserID=' + $('#advertiser_id').text() + '&orderID=' + orderid,
datatype:'json',
mtype: 'POST',
colNames: ['ID','Name','Company','Email','City','State/Province','Country','Cost'],
colModel: [{ name: 'id', index: 'id',align:'center',width:'80px',sortable:false},
{ name: 'name', index: 'name',width:'110px',align:'left',sortable:false},
{ name: 'company', index: 'company',width:'200px',align:'right',sortable:false},
{ name: 'email', index: 'email',width:'200px', align:'center',sortable:false},
{ name: 'city', index: 'city',align:'right',width:'205px',sortable:false},
{ name: 'state', index: 'state',width:'200px',align:'right',sortable:false},
{ name: 'country', index: 'country',width:'200px', align:'center',sortable:false},
{ name: 'cost', index: 'cost',align:'right',width:'205px',sortable:false},
],
rowNum:20,
pager: pager_id,
sortname: 'id',
sortorder: 'asc',
height: '100%'
});
jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:false,add:false,del:false})
},
subGridRowColapsed: function(subgrid_id, row_id) {
// this function is called before removing the data
//var subgrid_table_id;
//subgrid_table_id = subgrid_id+"_t";
//jQuery("#"+subgrid_table_id).remove();
},
serializeGridData: function (data){
return $.toJSON(data);
}
Спасибо,
A