Forum


16:58

08/03/2010

Hi everybody,
i'm new with jqQuery and i'm not able to load data in json format. Here is the structure of my json data :
{ persons :
[ { id : 001 , name : toto },
{ id : 002 , name : titi },
{ id : 003 , name : tata },
{ id : 004 , name : tete }
]}
}
So, i've tried to use the property jsonReader like this :
root:"persons>persons",
repeatitems:true,
id: "0"
}
I'm using firebug and jquery-1.3.2.
There is no errors when the page is loaded but there is nothing in my grid.
I'm retrieve data directly from the server without the chance to manipulate the reponse. Please help me.
I give you my whole javascript code :
console.log("Trace begin");
$("#list").jqGrid({
url:'http://'+ipserveur+'/services/persons/list',
datatype: "json",
mtype: 'GET',
colNames:['Id','Name'],
colModel:[
{name:'id',index:'id', width:55},
{name:'name',index:'name', width:90},
],
viewrecords: true,
sortorder: "desc",
jsonReader: { root:"persons>persons", repeatitems:true, id: "0"},
imgpath: 'themes/basic/images',
caption:"Persons Listing", height: 200, width : 700 });
console.log("Trace End");
$("#list").jqGrid('navGrid',"#pager",{edit:false,add:false,del:false});
});
18:48

09/11/2009

With Firebug, Network tab, you can check parameters of your url http://'+ipserveur+'.....rsons/list
Header, Reply ,HTML
Check reply if empty ... if yes you know where is your problem ...
Rgds,
Phicarre
18:55

Moderators
30/10/2007

Hello,
Thanks Phicarre, but I think that the problem is in repeatitems, in this case (named data) the repeatitems should be set to false.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
19:13

08/03/2010

19:18

Moderators
30/10/2007

Hello,
Which version do you use?
Try to use the latest and set in the jsonReader this (your reader is not configuret right I see right now)
jsonReader: { root:"persons.persons", repeatitems:false, id: "0″},
Also not >, but .
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
56 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