【发布时间】:2013-11-22 06:13:09
【问题描述】:
我正在使用 Jqgrid 4.5。我的网格在使用 javascript 的页面加载时绑定得很好。我启用了虚拟滚动,但是当我向下滚动页面时,并没有向服务器发出新请求。面对它什么都不做。只需坚持页面加载时的记录即可。我不知道我哪里出错了,我使用了网上找到的所有解决方案,但无法正常工作。我的绑定 JqGrid 的代码是:
jQuery("#list2").jqGrid(
{
url: '../ReportsLoadService.asmx/GetPublishHistory',
datatype: "json",
ajaxGridOptions: { contentType: "application/json" },
mtype: "POST",
postData:
{
//Sortby: Sortby,
//sidx: sidx,
//page: page,
//rows: rows,
PostProfileId: PostProfileId,
startdate: startdate,
starttime: starttime,
enddate: enddate,
endtime: endtime,
ServiceName: ServiceName,
Url: Url,
UrlTitle: UrlTitle,
Status: Status,
DateOption: DateOption
},
serializeGridData: function(data) {
return JSON.stringify(data);
},
colNames: [
'Service Name', 'Title', 'Schedule Date', 'Status', 'Posting Error'
],
colModel: [
{
name: 'ServiceName',
index: 'ServiceName',
resizable: false
},
{
name: 'Title',
index: 'Title',
formatter: 'showlink',
formatoptions: { baseLinkUrl: 'Url', addParam: '', idName: '' },
resizable: false
},
{
name: 'ScheduleDate',
index: 'ScheduleDate',
align: 'center',
resizable: false
},
{
name: 'Status',
index: 'amount',
resizable: false
},
{
name: 'PostingError',
index: 'PostingError',
resizable: false
}
],
jsonReader: {
root: "d.Records",
page: "d.CurrentPage",
//records: "d.TotalRecords",
repeatitems: false
},
rowNum: 50,
rownumbers: true,
//rowList: [20, 30, 50],
//sortname: "Title",
//rowTotal: 2000,
pager: '#pager2',
viewrecords: true,
sortorder: "desc",
//height: "100%",
//autowidth: true,
scroll: 1,
loadonce: false,
gridview: true,
prmNames: { npage: 1 }
});
指出我做错了什么,因为我的要求需要虚拟滚动,而我无法使其工作。
【问题讨论】:
-
我的脚本顺序是:
-
我正在使用 jquery 1.8.3
-
我自己解决了我在 jqgrid 中设置了错误的分页选项,这就是它产生问题的原因。现在它工作正常。