我使用亞格爲jqGrid的。它是1級。以下是我的代碼。我不知道我在這裏做錯了什麼。但這種格式傳遞值次網格JSON格式_search,ND的rowNum
_search =假& ND = 1303143441927個&行= 20 &頁= 1 & SIDX = ID & SORD = ASC
代替
{ 「_search」:假, 「ND」: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);
}
感謝, 一個