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
JSON SubGrid with repeatitems:false
02/09/2009
14:02
Avatar
Kien Nguyen
Guest
Guests

Hello,

Sorry for the cross-post, but I was wondering if this is a bug or unsupported feature.

http://www.trirand.com/blog/?p.....lse/#p9189

Kien Nguyen said:

Hello,

I was wondering how to get JSON SubGrid with repeatitems:false working. The demo shows an example with repeatitems:true and I've got this working, however, for repeatitems:false to work I assume it needs column index names supplied somehow (as opposed to the label names supplied by “subGridModel: [{name:[]}]” as per the demo. Can this be done? Thank you.

I have tried the following methods that do not appear to work:

subGridModel: [
{name:'id',index:'id',label:'ID', width:100},
{name:'name',index:'name',label:'Name',width:100}
]

subGridModel: [
{name:['id','name'], index:['id','name'], width:[100,100], align:['left','left'], params:['id']}
]


04/09/2009
02:50
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

where you set repeatitems. Look at the docs. Maybe you need:

jsonReader :{

...

subgrid : {repeatitems: false}

}

I.e this shoul be set in subgrid object.

Best Regards

Tony

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.

04/09/2009
12:16
Avatar
Kien Nguyen
Guest
Guests

Hello, my jsonReader code is currently as follows, which doesn't seem to work. 

{jsonReader: {repeatitems:false, subgrid: {repeatitems:false} }

Also, this is the json data being returned by the subgrid expansion call as per FireBug. This seems to follow the default format as noted in the wiki.

{"rows":[{"id":5,"name":"HWS"},{"id":7,"name":"CRC"}]}

The subgrid does open with the correct columns (id and name) and the browser is requesting and receiving the json data above, but jqGrid is not loading this data into the subgrid. Thanks for helping.

04/09/2009
13:09
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

The problem:

1. There was a missed documentation on how to use this - sorry.

You should add a mapping property like this

subGridModel: [
{name:['id','name'], index:['id','name'], mapping:['id','name'], width:[100,100], align:['left','left'], params:['id']}
]

2. I have corrected this behaviour - i.e if the mapping is not defined a name property is used.

Thanks

Best Regards

Tony

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.

04/09/2009
14:23
Avatar
Kien Nguyen
Guest
Guests

Thank you, it works. Smile

30/10/2009
11:54
Avatar
Stephan
Guest
Guests

Sorry to ressurcet this thread, but I have exactly the same problem.

I'm using v.3.5.3. Here are portions of the jqGrid declaration:

                jsonReader: {
                    repeatitems: false,
                    id: “ID”,
                    subgrid: {
                        repeatitems: false,
                        id: “ID”
                    }
                },

                subGridModel: [
                    { name: ['ID', 'RowPrice', 'Status', 'DiscountFlatOff', 'DiscountPercentOff'],
                      index: ['ID', 'RowPrice', 'Status', 'DiscountFlatOff', 'DiscountPercentOff'],
                      width: [60, 60, 60, 60, 60],
                      mapping: ['ID', 'RowPrice', 'Status', 'DiscountFlatOff', 'DiscountPercentOff']}]

The returned json data looks like this (via FireBug):

{"rows":[{"ID":1,"RowPrice":"1","Status":"Current","DiscountFlatOff":"0","DiscountPercentOff":"0"}]}

I believe this is valid format.

I have done everything as described, but still the subgrid is empty.

To summarize the problem: The subgrid does open with the correct columns (id and name) and the browser is requesting and receiving the json data above, but jqGrid is not loading this data into the subgrid.

thx
Stephan
05/06/2013
15:06
Avatar
webdevilopers
New Member
Members
Forum Posts: 1
Member Since:
05/06/2013
sp_UserOfflineSmall Offline

Same problem as Stephan - what is the correct structure for a JSON result using subgrid?

07/06/2013
08:22
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

There is no need to set the id in the subgrid reader.

The JSON string IMHO is correct

Only the mapping  can make some problems.

Please try withourt mapping option and let me know if this work.

I will check this option in the meantime.

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