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 data as array of arrays?
22/10/2009
11:59
Avatar
Dave
Guest
Guests

Hi....

Is it possible to directly use JSON data returned from the server in the following format:

  { "reportObject" : { "columnNames" : [ "from__campaign_name",
          "to__campaign_name",
          "transfer_count"
        ],
      "columnTypes" : [ "VARCHAR",
          "VARCHAR",
          "BIGINT"
        ],
      "createTimeStamp" : "2009-10-21 17:42:58",
      "results" : [ [ "Basic_EN_AfterHours",
            "",
            "34"
          ],
          [ "Basic_EN_CaseLU",
            "",
            "28"
          ],
          [ "Basic_EN_CaseLU",
            "Basic_EN_Greeting",
            "82"
          ],
          [ "Basic_EN_CaseLU",
            "B_Other",
            "55"
          ],

The "results" element contains all of the data for the table cells.

Thanks,

Dave

22/10/2009
12:25
Avatar
John
Guest
Guests

Not directly, but you can use jsonReader to match up your returned data to the data expected by the grid. See /jqgridwiki/doku.php?id=wiki:retrieving_data#json_data

22/10/2009
23:10
Avatar
Dave
Guest
Guests

Thanks, John...

I'm still having trouble with this, though.  The example shows data arranged in an array of unnamed objects, not an array of arrays.

I tried setting cell:"" in the jsonReader, but it's still not getting the data to display.  What should I have for the colModel ?  This is what I have so far:

    colModel :[
      {name:'from_campaign_name', width:300},
      {name:'to_campaign_name',  width:300},
      {name:'transfer_count', width:100}
       ],
    pager: jQuery('#pager'),
    rowNum:10,
    rowList:[10,20,30],
    sortname: '',
    sortorder: "",
    viewrecords: true,
    imgpath: 'themes/basic/images',
    caption: 'My first grid',
    jsonReader : {
       root: "results",
       page: "",
       total: "",
       records: "",
       repeatitems: true,
       cell: ""
       }
 

I get the table header and footer, but no data.

Thanks,

Dave

27/10/2009
03:04
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Read to the end.

http://www.trirand.com/jqgridw.....t_notation

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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