Hi! I'm not american, so excuse me for the syntax…I have a problem: I don' t understand how to insert data in my grid:
I have a php program; when I call it, it send me a json file, in string format, with a ECHO.
I don't understand how I can set parameters of JSONREADER function of jqgrid..
The grid apperas in html page, but it's empty.
I post the code:
PHP:
<?php
$jsstring= '{
"shops":{
"shop1″:{
"name": "Market FK",
"address": "Farini street",
"num": "92838390″
},
"shop2″:{
"name": "Fruit Yeah",
"address": "Plaza Tree",
"num": "4434886″
}
}
}';
echo $jsstring; ?>
THIS JSON FILE IS NOT AN ARRAY. I DON'T KNOW IF AN ARRAY JSON FILE IS BETTER, BUT I CAN'T CHANGE THE JSON FILE!!!
JAVASCRIPT:
$(document).ready(function() {
$("#id_table ").jqGrid({ url:"url of php file",
datatype: "jsonstring", //is it correct??
mtype: "GET",
colNames:["Name","Address", "Tel number"],
colModel:[ {name:'name',index:'name', width:100}, //is it correct??
{name:'address',index:'address', width:120},
{name:'tel',index:'tel', width:100}
],
jsonReader : {
HERE I DON'T KNOW HOW TO SET
}
});
});
I WANT TO HAVE A GRID WITH:
first column: the names of the shop
second column: the address
third colum: tel numbers
So a grid like this:
- Market FK Farini street 92838390
- Fruit Yeah Plaza Tree 4434886
THANK YOU VERY MUCH