Forum



18:52

21/09/2009

I cannot import my json data into a grid. I get an empty grid. I hope someone has a solution.
The json data seems to be improperly formated.
It looks like this:
{"total":"3","page":"1","records":"71",
"rows":{
"1":{"id":"1","cell":[1," Configuration Method","Using traditional Weather Display"]},
"2":{"id":"2","cell":[2,"CSSprint","weather-print-php.css"]},
"3":{"id":"3","cell":[3,"CSSscreen","weather-screen-black-narrow.css"]}, ...
]}}}
The problem is with the {"1" after "rows": and the "n" before each new {"id": which I have highlighted in the jSon above.
It should be "rows":[{"id"}
If I hand code the JSon it works.
The relevant php is:
if($page > 1)
{
$i = $page*30;
}
else
$i = 1;
$rows = array();
$responce['total'] = "$total_pages";
$responce['page'] = "$page";
$responce['records'] = "$count";
foreach ($this->wdConfig as $key=>$value)
{
$responce['rows'][$i]['id'] = "$i";
$responce['rows'][$i] ['cell'] = array($i,$key,$value);
$i++;
}
$this-wdConfig is an object that has key/value configuration pairs in it.
The jSon output can be seen at:
http://billhogsett.com/wd/wd2/configToJson.php
I see a couple of possible approaches, but cannot figure either out.
1. Get the jSon to format properly (i.e, what jQgrid expects)
2. Configure jSonReader to handle my jSon
I will try and report back on any suggestions given to me.
Thanks.
Bill
Most Users Ever Online: 715
Currently Online:
61 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66