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
Pager Buttons not working
24/01/2014
20:22
Avatar
dwschulze
United States
Member
Members
Forum Posts: 11
Member Since:
24/01/2014
sp_UserOfflineSmall Offline

I've got jqGrid set up to do AJAX calls.  The initial page loads, but the pager buttons don't work.  I can page by changing the page number in the text box and clicking Enter.  An AJAX call gets made with the new page number and the new page of data displays properly.  When I click on any of the pager buttons no AJAX call is made, however.  The buttons seem to be disabled by default.

What do I have to do to get the pager buggons to work?

24/01/2014
20:31
Avatar
Lonewolf217
Member
Members
Forum Posts: 32
Member Since:
22/05/2013
sp_UserOfflineSmall Offline

hard to tell without sample code and the json response, but i think i have seen this happen in a couple of cases

1) when I did not properly set the "records" count in  the response.  

2) when the "rowNum" attribute of the grid is set to nothing (ie '' ).  You can set the rows attribute to a high number to work around this

In both cases though, the result is that the grid isn't able to calculate that multiple pages are available so the paging buttons are disabled. 

24/01/2014
21:58
Avatar
dwschulze
United States
Member
Members
Forum Posts: 11
Member Since:
24/01/2014
sp_UserOfflineSmall Offline

Here's the code.  I had to copy and past one line at a time because this forum software reverses line of code copied and pasted (first line of code last, last line of code first).  This is the worst forum software I've ever seen.

$("#grid").jqGrid({

     datatype: "json",

url: "/mtprest/Product/productByStatus?status=awaiting",

jsonReader : {

root:"products",

page: "currentPage",

total: "totaPages",

records: "totalRecords",

repeatitems: false,

id: "0"

                 },

                pager: "#pager",

colModel: [

...

],

rowNum: 6,

viewrecords: true

});

$("#grid").jqGrid("navGrid", "#pager");

24/01/2014
22:02
Avatar
Lonewolf217
Member
Members
Forum Posts: 32
Member Since:
22/05/2013
sp_UserOfflineSmall Offline

Can you provide a sample json response as well ?

24/01/2014
22:16
Avatar
dwschulze
United States
Member
Members
Forum Posts: 11
Member Since:
24/01/2014
sp_UserOfflineSmall Offline

The number of rows is coming back.  It shows up in the lower right corner.  Sorry I can't post an image on this forum software, but the total number of records shows up as well as the correct record enumeration for the current page.

The text control works if I type in a new page number followed by Enter.  It's just the buttons that dont work.

Here's the JSON 

{"currentPage":2,"totalPages":3,"totalRecords":18,"products":[{"invid":49411615,"serialNumber":"2173J244SP","sONumber":"5137269","partNumber":"59701-32","desc":"Kit - Receiver, Dual Autonomous/SBAS/DGPS GPS-only, MS992, Carry Case, GCS","shippedDate":null,"soldDate":null,"status":"Awaiting Validation"},{"invid":49411616,"serialNumber":"2173j235sp","sONumber":"5137269","partNumber":"59701-32","desc":"Kit - Receiver, Dual Autonomous/SBAS/DGPS GPS-only, MS992, Carry Case, GCS","shippedDate":null,"soldDate":null,"status":"Awaiting Validation"},{"invid":49411617,"serialNumber":"2173j259sp","sONumber":"5137269","partNumber":"59701-32","desc":"Kit - Receiver, Dual Autonomous/SBAS/DGPS GPS-only, MS992, Carry Case, GCS","shippedDate":null,"soldDate":null,"status":"Awaiting Validation"},{"invid":49411618,"serialNumber":"2173J582SP","sONumber":"5137269","partNumber":"59701-32","desc":"Kit - Receiver, Dual Autonomous/SBAS/DGPS GPS-only, MS992, Carry Case, GCS","shippedDate":null,"soldDate":null,"status":"Awaiting Validation"},{"invid":49411619,"serialNumber":"2173J606SP","sONumber":"5137269","partNumber":"59701-32","desc":"Kit - Receiver, Dual Autonomous/SBAS/DGPS GPS-only, MS992, Carry Case, GCS","shippedDate":null,"soldDate":null,"status":"Awaiting Validation"},{"invid":49411620,"serialNumber":"1956042675","sONumber":"1042427","partNumber":"63610-00","desc":"Trimble Business Center Advanced - Dongle License","shippedDate":null,"soldDate":null,"status":"Awaiting Validation"}]}
I've checked that it is valid json at http://www.freeformatter.com/json-validator.html.  The rows in the table contain the correct data.
It's just the buttons that don't work.

Adding "pgbuttons: true," didn't help

24/01/2014
22:23
Avatar
Lonewolf217
Member
Members
Forum Posts: 32
Member Since:
22/05/2013
sp_UserOfflineSmall Offline

I see that you are trying to customize which items to use in the response

page: "currentPage",

total: "totaPages",

records: "totalRecords",

I tried it on my setup and it doesn't seem to be working for me.  the pagers are greyed out.  Can you try using the default parameters by removing the above lines from your jqgrid config and then sending the response back with the json constructed like this ?

{"page":"2","total":11,"records":"110","rows":

Unless you have a good reason to require renaming the default parameters in the response ?

24/01/2014
22:39
Avatar
dwschulze
United States
Member
Members
Forum Posts: 11
Member Since:
24/01/2014
sp_UserOfflineSmall Offline

Changing the JSON names back to defaults solved it.  Thanks for your help.

Where in the docs do I look for assigning class attributes to <th>, <tr>, <td> elements?

Thanks again.

24/01/2014
22:41
Avatar
Lonewolf217
Member
Members
Forum Posts: 32
Member Since:
22/05/2013
sp_UserOfflineSmall Offline

can you clarify the question, it is far too vague right now to give a proper answer.  You may also want to start a new thread if it is unrelated to the current problem

26/09/2014
16:56
Avatar
mrkarthick14
New Member
Members
Forum Posts: 2
Member Since:
26/09/2014
sp_UserOfflineSmall Offline

I have the same issue. But i did not change those json names.. How to fix it ?

01/10/2014
12:48
Avatar
mrkarthick14
New Member
Members
Forum Posts: 2
Member Since:
26/09/2014
sp_UserOfflineSmall Offline

Fixed by adding "records" in jqgrid json data

03/10/2014
13:29
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

 

Thanks for the feedback.

 

Kind 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: 496

Currently Online:
34 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