Forum


07:24

21/10/2011

Hi,
I am now trying to using jdGrid and load the data returned by WCF.
I can successfully retreive the data in json format but i fall to load the data into the grid.
Here's what I write:
var service_endpoint = "http://127.0.0.1:49303/Service1.svc/";
$("#list2″).jqGrid({
url : service_endpoint + "GetUsers",
datatype : "json",
jsonReader : {
root : "rows",
page : "page",
total : "total",
records : "records",
repeatitems : false,
id : "Username"
},
colNames : ['Username', 'Userteam','Usertitle','Useraccount'],
colModel : [{
name : 'Username',
index : 'Username',
width : 60,
align : "right"
}, {
name : 'Userteam',
index : 'Userteam',
width : 120,
sortable : false
}, {
name : 'Usertitle',
index : 'Usertitle',
width : 120,
sortable : false
}, {
name : 'Useraccount',
index : 'Useraccount',
width : 120,
sortable : false
}],
pager : '#pager2',
rowNum : 10,
rowList : [10, 20, 30],
sortname : 'Username',
viewrecords : true,
sortorder : "asc",
caption : "Users"
}).navGrid('#pager2', { edit: false, add: false, del: false, view: false, refresh: false });
wcf response:
HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Fri, 21 Oct 2011 04:21:23 GMT
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: application/json; charset=utf-8
Content-Length: 1039
Connection: Close
{"page":1,"records":159,"rows":[{"Useraccount":"","Username":"","Userteam":"","Usertitle":""},{"Useraccount":"awa840","Username":"awa840","Userteam":"TESTA","Usertitle":"TEST"}],"total":16}
The data returns seems in correct format but the data is not loaded into the grid. Have I missed anything?
Thanks very much.
Most Users Ever Online: 715
Currently Online:
54 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