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_TopicIcon
jqGrid problem with jqGrid 4.3.2
05/05/2012
11:54
Avatar
staleks
New Member
Members
Forum Posts: 2
Member Since:
05/05/2012
sp_UserOfflineSmall Offline

Hi,

I am recently trying jqGrid in order to use it on some of the pages that I am developing using SpringMVC, JSP.

data that I want to use is JSON.

I'am pretty sure that JSON response comming from server-side is ok, but jqGrid is stuck with the message "Loading…" and nothing happens (data is not populated in grid).

here is the response

{"page":"1",
"total":"2",
"records":"21",
"rows":[
{"name":"SRBIJA","alpha2":"RS","alpha3":"SRB"},
{"name":"HRVATSKA","alpha2":"HR","alpha3":"CRO"},
{"name":"AFGHANISTAN","alpha2":"AF","alpha3":"AFG"},
{"name":"ALBANIA","alpha2":"AL","alpha3":"ALB"},
{"name":"ALGERIA","alpha2":"DZ","alpha3":"DZA"},
{"name":"AMERICAN SAMOA","alpha2":"AS","alpha3":"ASM"},
{"name":"ANDORRA","alpha2":"AD","alpha3":"AND"},
{"name":"ANGOLA","alpha2":"AO","alpha3":"AGO"},
{"name":"ANGUILLA","alpha2":"AI","alpha3":"AIA"},
{"name":"ANTARCTICA","alpha2":"AQ","alpha3":"ATA"},
{"name":"ANTIGUA AND BARBUDA","alpha2":"AG","alpha3":"ATG"},
{"name":"ARGENTINA","alpha2":"AR","alpha3":"ARG"},
{"name":"ARMENIA","alpha2":"AM","alpha3":"ARM"},
{"name":"ARUBA","alpha2":"AW","alpha3":"ABW"},
{"name":"AUSTRALIA","alpha2":"AU","alpha3":"AUS"},
{"name":"AUSTRIA","alpha2":"AT","alpha3":"AUT"},
{"name":"AZERBAIJAN","alpha2":"AZ","alpha3":"AZE"},
{"name":"BAHAMAS","alpha2":"BS","alpha3":"BHS"},
{"name":"BAHRAIN","alpha2":"BH","alpha3":"BHR"},
{"name":"BANGLADESH","alpha2":"BD","alpha3":"BGD"}]}

When I see JS console (error tab in Firebug) I see that I have following error:

"b is undefined, jquery.jqGrid.min.js Line 23″

I must missed something. Can someone point me up where I am making mistake?

I've imported following resources:

<link rel="stylesheet" type="text/css" href="<c:url value="/css/ui-lightness/jquery-ui-1.8.18.custom.css" />" media="screen" />
<link rel="stylesheet" type="text/css" href="<c:url value="/css/ui.jqgrid.css" />" media="screen" />

<script src="<c:url value="/js/jquery-1.7.2.min.js" />" type="text/javascript"></script>
<script src="<c:url value="/js/jquery.corner.js" />" type="text/javascript"></script>
<script src="<c:url value="/js/jquery-ui-1.8.18.custom.min.js" />" type="text/javascript"></script>
        
 <script src="<c:url value="/js/jquery.jqGrid.min.js" />" type="text/javascript"></script>        
 <script src="<c:url value="/js/i18n/grid.locale-en.js" />" type="text/javascript"></script>

07/05/2012
00:02
Avatar
zippy
Member
Members
Forum Posts: 3
Member Since:
06/05/2012
sp_UserOfflineSmall Offline

If you replace your reference to jquery.jqGrid.min.js with jquery.jqGrid.src.js you can get a better idea of the function that is causing the error, since that's the uncompressed version of the JQGrid code with meaningful variable and function names.

The error message you're getting looks the same as what I was getting before I made this replacement in an attempt to debug - see my post: /blog/?page_id=393/help/cannot-get-jqgrid-working-with-json-data/ . I have not yet figured out what I am doing wrong, but I hope someone here can.

07/05/2012
02:55
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

In any way you should include grid.locale-en.js before jquery.jqGrid.min.js (see the documentation). Moreover you should use jsonReader parameter which corresponds your JSON data. For example it could be

jsonReader: { repeatitems: true }

It would be good to include id property in the data. The following could be used

jsonReader: { repeatitems: true, id: "name" }

but the "name" values contains spaces which is not good for ids.

Best regards
Oleg 

07/05/2012
10:17
Avatar
staleks
New Member
Members
Forum Posts: 2
Member Since:
05/05/2012
sp_UserOfflineSmall Offline

Thank you Oleg and zippy,

after I followed zippy's recomendation to use 

<script src="<c:url value="/js/jquery.jqGrid.src.js" />" type="text/javascript"></script>

I've determined that problem was in line 151, obj is not defined.

That gave me some good google points what to look for 🙂

I've found this one that Oleg already answered (partly in response to me)

http://stackoverflow.com/quest.....1#10474871

Now when I got it working (thank you again for all your help), I was wondering why this is not in DEMO? 

I think that I am not only that will stumble upon this 🙂

Cheers guys

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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