jQuery UI Widgets › Forums › Grid › how to use 2dimensional json in jqxgrid
Tagged: grid, jqxgrid, json, multi dimension json, nested json
This topic contains 2 replies, has 2 voices, and was last updated by homam 13 years, 6 months ago.
Viewing 3 posts - 1 through 3 (of 3 total)
-
Author
-
hi
i have a 2 dimensional json as follows and i tried all possibilities i thought may work but i could not determin it can you help?
here is my json (although it is really big here is just 2 of it) and i want only the contents of the result for my columns
[ { "status": 200, "result": [ { "filename": "00000129", "fileid": 129, "title": "aghati", "duration": "", "type": "RAW", "ability": "PAUSE" }, { "filename": "00000130", "fileid": 130, "title": "moazenzade", "duration": "", "type": "RAW", "ability": "PAUSE" } ] } ]Hello homam,
Here is what to do:
var json = '[{ "status": 200, "result": [{ "filename": "00000129", "fileid": 129, "title": "aghati", "duration": "", "type": "RAW", "ability": "PAUSE" }, { "filename": "00000130", "fileid": 130, "title": "moazenzade", "duration": "", "type": "RAW", "ability": "PAUSE"}]}]'; var obj = $.parseJSON(json); var status = obj[0].status; var result = obj[0].result; // prepare the data var source = { datatype: "json", datafields: [ { name: 'filename', type: 'string' }, { name: 'field', type: 'int' }, { name: 'title', type: 'string' }, { name: 'duration' }, { name: 'type', type: 'string' }, { name: 'ability', type: 'string' } ], id: 'field', localdata: result }; var dataAdapter = new $.jqx.dataAdapter(source);
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/HI
best of the best thanks -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.