Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
number of pages and total records do not display correctly
20/03/2012
10:11
Avatar
jerry.chan
中国
New Member
Members
Forum Posts: 1
Member Since:
20/03/2012
sp_UserOfflineSmall Offline

  I have a jqgrid which retrieves data from wcf.  and data of rows are displayed correctly in grid. but the number of pages and total records are displayed wrong, the value of total and records is right in the response data. 

any help will be appreciated. thank you in advance.

my js code is below:

$(document).ready(function () {

     $("#table").jqGrid({

         datatype: function () { getData(); },

         editurl: "About.aspx",

         height: 120,

         colNames: ['ID', 'CODEID', 'COMPID', 'UNAME', 'IVALUE', 'SNAME', 'MNAME', 'PNAME', 'CDATE'],

        colModel: [

           { name: 'ID', index: 'ID', jsonmap: 'ID', width: 80, sortable: true },

  { name: 'CODEID', width: 80, sortable: true, editable: true, editrules: { required: true, number: true} },

  { name: 'COMPID', width: 80, sortable: true, editable: true, editrules: { required: true} },

    { name: 'UNAME', width: 80, sortable: true, editable: true, editrules: { required: true} },

 { name: 'IVALUE', width: 80, sortable: true, editable: true, editrules: { required: true} },

 { name: 'SNAME', width: 80, sortable: true, editable: true, editrules: { required: true} },

 { name: 'MNAME', width: 80, sortable: true, editable: true, editrules: { required: true} },

 { name: 'PNAME', width: 80, sortable: true, editable: true, editrules: { required: true} },

 { name: 'CDATE', width: 120, sortable: false, editable: true, editrules: { required: true, date: true} }],

        imgpath: "Styles\images",

sortname: 'ID',

pager: '#gridpager',

sortorder: "asc",

loadtext: "Loading....",

viewrecords: true,

viewpages: true,

loadui: "block",

rownumbers: true,

loadonce: true,

rowNum: 5,

rowList: [5, 10, 20],

caption: "Jquery,JqGrid,WCF,Linq,Json",

onSelectRow: function (id) {

if (id && id !== lastsel) { lastsel = id; } }

  });

function getData() {

beginGridRequest("table");

var page = $('#table').getGridParam('page');

var rowNum = $('#table').getGridParam('rowNum');

var sortorder = $('#table').getGridParam('sortorder');

var sortname = $('#table').getGridParam('sortname');

var params = "page=" + page + "&rowNum=" + rowNum + "&sortorder=" + sortorder + "&sortname=" + sortname;

var url = "http://localhost:32775/WcfService/AjaxWcf.svc/SearchItem?" + params;

$.getJSON(url, {}, function (data) {

ReceivedClientData(JSON.parse(getMain(data)).rows);

});

setTimeout('endGridRequest("table")', 300);

 }

Json from wcf :  "page":"1","total":3,"records":"13",

data on pager is        Page  1of 0             View 1 - 5 of 5   ,  the right data should be   Page  1 of 3             View 1 - 5 of 13

does anyone have the same problem?

21/03/2012
19:44
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

This response does not have sense , since you use datatype as funcion.

Check what you do in this function and what you return from it.

Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
31 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information