I cannot import my json data into a jQgrid. 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":
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.
Get the jSon to format properly (i.e, what jQgrid expects)
Configure jSonReader to handle my jSon
I will try and report back on any suggestions given to me.
Thanks.
Bill