November 2nd, 2014

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
How to read nested json list in jqgrid
New Member
Forum Posts: 1
Member Since:
sp_UserOfflineSmall Offline

This is my Grid data


  $(document).ready(function (){
            var i; i=0;
        url: '/display_rpt_expectedtableSchema?rpt_step_id=<%=@rpt_step_id%>&header_data=true',
        success: function (data, st) {
            if (st == "success") {
                var columnData = jQuery.parseJSON(data)
               // for(i=0;i<columnData.source.length; i++)  {alert('how many loops'); alert(i);
                    //url : '/display_rpt_expectedtableSchema?rpt_step_id=<%=@rpt_step_id%>&header_data=false',
                    datastr: columnData.source,
                    pager: '#schemaPager',
                    datatype: "jsonstring",
                    colNames: ['ExpTableName','ExpColumn', 'ExpType', 'ExpSize'],
                    cmTemplate: { title: false },
                    /*colModel:  [
                        {name:'tableName',index:'tableName', width:145,jsonmap:'columns'+'.'+i+'.'+'tableName'},
                        {name:'name',index:'name', width:145,jsonmap:'columns'+'.'+i+'.'+'name'},
                        {name:'type',index:'type', width:145,jsonmap:'columns'+'.'+i+'.'+'type'},
                        {name:'size',index:'size', width:145,jsonmap:'columns'+'.'+i+'.'+'size'}
                    colModel:  [
                        {name:'tableName',index:'tableName', width:145,jsonmap:'tableName'},
                        {name:'name',index:'name', width:145,jsonmap:'name'},
                        {name:'type',index:'type', width:145,jsonmap:'type'},
                        {name:'size',index:'size', width:145,jsonmap:'size'}

                    //jsonReader:{repeatitems: false,root:'source'+'.'+i+'.'+'columns'},
                    jsonReader:{repeatitems: false,root:'source.0.columns'},
                    rowNum: 25,
                    viewrecords: true,
                    caption: "Expected Schema",
                    height: 600,
                    width: 600,
                    //multiselect: true,
                    autoFitColumns: true,
                    loadonce: true,
                    autoencode: true,
                    shrinkToFit: false,
                    ignoreCase: true



      //      }
        error: function () {
            alert("Error with AJAX callback");


and Here is my JSON Object






{"id":2,"columns":[{"name":"Amt","type":"Money","size":" 0","tableName":"Loan"},

{"name":"Tenure","type":"int","size":" 0","tableName":"Loan"}]},

{"id":3,"columns":[{"name":"Amt","type":"Money","size":" 0","tableName":"xyz"},

{"name":"Tenure","type":"int","size":" 0","tableName":"xyz"}]}]} 

Data displaying in grid with first list which is "ID":1 but not "id" 2,3






Because Here I have used JsonReader as root: 'source.0.columns'.

My requirement is to load whole json object data in the above grid (i.e have to load id '1','2','3')

I tried to loop it in jsonReader:{repeatitems: false,root:'source'+'.'+i+'.'+'columns'} by getting count of the "columns" list in the object (looping the whole the grid). But Grid is loading values for first json list and not loading other 2 lists.

Is there any other approach to load given json object with the data in grid? Is there any way to loop the jsonreader to display all the jsonlist data?

How to read this kind json data in grid. am I going in right direction?

Please help me on this.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 496

Currently Online:
28 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,

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information