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
jqGrid Tutorial
14/02/2013
19:05
Avatar
Jeeni Software
Bristol, UK
New Member
Members
Forum Posts: 2
Member Since:
14/02/2013
sp_UserOfflineSmall Offline

Thought some of you guys might find a tutorial/example I put together for using the jqGrid with a backend JSON feed. The backend is based on Spring MVC.  The example uses JQuery and a select box to update the jqGrid contents. Hope you find it helpful.

http://www.jeenisoftware.com/j.....n-example/

15/02/2013
11:44
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello,

I find in general very good to share his exerience with other people, but it's better to post more correct examples. I am not Spring MVC developer and not Java developer at all, but some clear errors I could see in the example which you posted here:

  • you use very old version 1.4.4 of jQuery in the demo. Moreover you used in the same demo jQuery UI 1.10 which supports only jQuery starting with 1.6. So you should update the code to use for example jQuery 1.9.1.
  • the server response of the server contains clear wrong data for records. The picture can display 20 rows per page and shows 4 rows. On the other side one can see "View 1 - 4 of 8" in the status. It's wrong information (see the line int totalNumberOfRecords = 8 in your code). You should modify your code to calculate total and records filed of the server response based on the number of records and the page size (rows).
  • I recommend you include following options to jqGrid: height: "auto", gridview: true, autoencode: true, sortname: "firstName".
  • you use in the demo index properties in colModel the same as the value of name property. I recommend you remove such index properties from colModel.
  • you should include at least sorting of output data which you return
  • I recommend you to use loadonce: true option if you provide the code without paging and filtering of the data.

Best regards
Oleg 

15/02/2013
12:49
Avatar
Jeeni Software
Bristol, UK
New Member
Members
Forum Posts: 2
Member Since:
14/02/2013
sp_UserOfflineSmall Offline

OK, will update over the next few days.

Thanks for the feedback.

15/02/2013
13:00
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

You are welcome!

One more clear bug in the posted code is the usage of <meta charset="utf-8"> before <head>. I recommend you to validate posted HTML code in http://validator.w3.org/ and validate JavaScript code on http://www.jslint.com/ or http://www.jshint.com/.

Best regards
Oleg 

Forum Timezone: Europe/Sofia

Most Users Ever Online: 496

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