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_Related Related Topics sp_TopicIcon
JSON - jsonstring, how to insert in grid
14/04/2012
13:37
Avatar
johannesynt
Member
Members
Forum Posts: 4
Member Since:
14/04/2012
sp_UserOfflineSmall Offline

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

Forum Timezone: Europe/Sofia

Most Users Ever Online: 496

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