Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






JSON – jsonstring, how to insert in grid

UserPost

13:37
14/04/2012


johannesynt

Member

posts 4

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


About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

157


Currently Online:

52 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 9579

Posts: 28750

Membership:

There are 10072 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1157

markw65 – 179

kobruleht – 144

phicarre – 126

YamilBracho – 124

Renso – 118

Administrators: admin (56 Posts)

Moderators: tony (6999 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information