我使用的jqGrid v4.4.5.When網格是空的,顯示「0'.I第1頁閱讀this answer 但我的問題是不是solved.My的HttpHandler發送此JSON結果jqGrid的空JSON數據
「 {\ 「頁面\」:0,\ 「記載\」:0,\ 「行\」:[],\ 「總\」:0,\ 「用戶數據\」:NULL}」
gridParaf = $("#gridParaf").jqGrid(
{
url:"GetLetterInformationHandler.ashx?CurrentUser=" + 1457,
datatype: 'json',
width: $("#contentParaf").width() + 410,
height: $("#contentParaf").height() - 20,
direction: "rtl",
colNames: ['IAnsDateTime', 'IAnsState'],
colModel: [
{ name: 'IAnsDateTime', width: 50, sortable: false, hidden: false, template: CenterTemplate },
{ name: 'IAnsState', width: 20, sortable: false, hidden: false, template: CenterTemplate },
],
rowNum: 20,
loadonce: true,
rowList: [5, 10, 20],
recordpos: "left",
ignoreCase: true,
toppager: true,
viewrecords: true,
sortorder: "desc",
scrollOffset: 1,
editurl: 'clientArray',
shrinkToFit: true,
jsonReader:
{
repeatitems: false,
},
gridview: true,
});
坦克但不工作:(。爲什麼當重新加載網格,網格傳遞pageindex = 1到服務器?我認爲我有問題,因爲pageindex是1.我計算其他信息在服務器「總=(計數+ 0 - 1)/ 10 「 」records = Count「 」total =(int)Math.Ceiling((float)objectList.Count /(float)numberOfRows);「 – ZSH
@ZSH:您必須爲'jsonReader'另外定義'localReader'因爲你使用'loadonce:true'。查看** UPDATED **我的答案的一部分 – Oleg
我定義了jsonReader和localReader,但都沒有工作,我設置了loadonce:false,但沒有工作。如果我在服務器中設置了pageIndex的值,obj.page在jsonReder中返回我的值({「page」:「1」,「records」:「0」,「rows」:[],「total」:「0」,「userdata」:null})但是, pageIndex(在json結果中)總是返回null。我很困惑,不知道該怎麼辦 – ZSH