i have a js file and pass parameters to a webmethod which returns the output in json format. only the first page is displayed. there are some 100 records and only 20 records are displayed. I need to display the other records in the subsequent pages. I tried adding a div tag after the table like
<div id="pager12" class="scroll" style="text-align:center;></div>
then in the jqgrid function $('#SearchForComp).jqGrid()
, I have added this line
pager: jQuery('#pager12')
. is that enough for displaying the output in pages or should I add anything? Its not working.
Thanks
jquery looks like this
$("#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; },
});
I call a webmethod "compsearch" that returns the data in json format and then display it to the user.