我有一个 js 文件并将参数传递给一个 webmethod,它以 json 格式返回输出。只显示第一页。大约有 100 条记录,仅显示 20 条记录。我需要在后续页面中显示其他记录。我尝试在表格之后添加一个 div 标签
<div id="pager12" class="scroll" style="text-align:center;></div>
然后在 jqgrid 中function $('#SearchForComp).jqGrid()
,我添加了这一行
pager: jQuery('#pager12')
。这足以在页面中显示输出还是我应该添加任何内容?它不工作。
谢谢
jquery 看起来像这样
$("#SearchForComp").jqGrid({
scroll: true,
treeGrid: true,
altRows: true,
treeGridModel: 'adjacency',
ExpandColumn: 'DISPLAY_NAME',
datatype: function (postdata) {
postdata.deptSeqNo = null;
postdata.searchString = $("#SearchForComp").val().trim();
$.ajax({
type: "POST",
url: 'Department.aspx/compsearch',
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify(postdata),
complete: completeUserSearch
});
},
mtype: "POST",
colModel: [{ name: 'KEY_FIELD', index: 'KEY_FIELD', width: 1, hidden: true, key: true },
{ label: 'Department/Name', name: 'DISPLAY_NAME', index: 'DISPLAY_NAME', width: 200, resizable: false, sortable: false },
{ label: 'Telephone', name: 'DISPLAY_PHONE', index: 'DISPLAY_PHONE', width: 150, align: 'center', resizable: false, sortable: false },
{ label: 'Email', name: 'DISPLAY_EMAIL', index: 'DISPLAY_EMAIL', width: 225, align: 'center', resizable: false, sortable: false, formatter: 'email'}],
treeIcons: { plus: 'ui-icon-plus', minus: 'ui-icon-minus', leaf: 'ui-icon-radio-off' },
height: 'auto',
caption: "User Search",
treeReader: {
level_field: "TREE_LEVEL",
parent_id_field: "PARENT_ID",
leaf_field: "IS_LEAF",
expanded_field: "EXPANDED"
},
jsonReader: {
root: "Data",
page: "CurrentPage",
total: "TotalPages",
records: "TotalRecords",
repeatitems: false,
id: "0",
userdata: "UserData"
},
beforeSelectRow: function (id, e) { return false; },
});
我调用了一个 web 方法“compsearch”,它以 json 格式返回数据,然后将其显示给用户。