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
Custom JSON Parsing - Arrays
09/12/2011
18:51
Avatar
bpcm
Member
Members
Forum Posts: 6
Member Since:
09/12/2011
sp_UserOfflineSmall Offline

Hello,

I'm having an issue with parsing a JSON string that contains an array:

{"max":20,"total":1,"rows":[{"line":"THIRD_LINE","cell":123456789,"aptitudeHashSet":[{"skillName":"Swimming" ,"value":1,"id":3,"color":"RED"},{"skillName":"Shotput","value":5,"id":1,"color":"WHITE"},{"skillName" :"Track","value":5,"id":2,"color":"GREEN"}],"name":"jon smith","id":1,"region":"The end","available" :true}],"page":1}


What I would like to have displayed in JQgrid is something like:

name region cell line SWIMMING ('skillName') swimmingColor ~~next skill etc
Jon Smith The end 123456789 FIRST_LINE 1 ('value') RED ~~next skill etc


In our DB we have a persons table that references a skills table with a list of skills.

Is this possible or do I need to generate a customized JSON string from the server?

Thanks,
bpcm

15/12/2011
17:37
Avatar
bpcm
Member
Members
Forum Posts: 6
Member Since:
09/12/2011
sp_UserOfflineSmall Offline

Anyone have any insight on this issue?

16/12/2011
11:01
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

You will need to configure your JSON reader. Reading docs us usefull thing.

http://www.trirand.com/jqgridw.....#json_data

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.

16/12/2011
18:07
Avatar
bpcm
Member
Members
Forum Posts: 6
Member Since:
09/12/2011
sp_UserOfflineSmall Offline

tony said:

Hello,

You will need to configure your JSON reader. Reading docs us usefull thing.

http://www.trirand.com/jqgridw.....#json_data

Regards


Hello,

I can seem to display data in the table using 'dot notation' but when I edit a 'person', jqGrid returns:

{"id":"12″,"name":"jon smith","region":"The end","line":"FIRST_LINE","skillName":"Swimming","color":"GREEN","value":"5″}

I think the problem is that I have unnamed arrays within an array; jqGrid ignores them
It does not return an array of skills.I would like it to return:

"id":"1″,"name":"jon smith","region":"The end","line":"FIRST_LINE",aptitudeHashSet":  [{"skillName":"Swimming","color":"silver","value":"5"}, {"skillName":"Shotput","color":"purple","value":"9"}]}

 

I think it needs to match format of servers JSON:

{"max":20,"total":1,"rows":[{"line":"THIRD_LINE","cell":123456789, "aptitudeHashSet":[{"skillName":"Swimming" ,"value":1,"id":3,"color":"RED"}, {"skillName":"Shotput","value":5,"id":1,"color":"WHITE"}, {"skillName" :"Track","value":5,"id":2,"color":"GREEN"}], "name":"jon smith","id":1,"region":"The end","available" :true}], "page":1}

  colModel:[  ...{
                name:'name',
                width:300,
                editable:true,
                editrules:{required:true}
            },{ width:52,
                editable:true,
                jsonmap:"aptitudeHashSet.1.value"
            }...];

jsonReader:{
            root:"rows",
            repeatitems:false}

Somehow I have configured jqgrid incorrectly. It seems the colmodel flattens out the arrays.

Thank you, bpcm

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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