Forum
November 2nd, 2014
A
A
A
Topic RSS
Related Topics
Offline
The forums are currently locked and only available for read only access



newb question- getting started
09/02/2011
17:40
17:40

sJhonny
New Member
Members
Forum Posts: 1
Member Since:
09/02/2011
09/02/2011

Hi,
I'm trying to get started with jqgrid, but I'm having trouble with a couple of things.
Firstly- getting the json data:
I define my table like so:
$("#tblTerminals").jqGrid({
url: 'SampleScriptService.asmx/GetAllTerminals',
data: '',
datatype: "json",
contentType: "application/json; charset=utf-8",
mtype: "POST",
colNames: ['Id', 'Name'],
colModel: [
{ name: 'id', index: 'TerminalId', width: 55 },
{ name: 'name', index: 'Name', width: 90 }
],
rowNum: 10,
rowList: [10, 20, 30],
pager: '#terminalsPager',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption: "Terminals"
});
url: 'SampleScriptService.asmx/GetAllTerminals',
data: '',
datatype: "json",
contentType: "application/json; charset=utf-8",
mtype: "POST",
colNames: ['Id', 'Name'],
colModel: [
{ name: 'id', index: 'TerminalId', width: 55 },
{ name: 'name', index: 'Name', width: 90 }
],
rowNum: 10,
rowList: [10, 20, 30],
pager: '#terminalsPager',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption: "Terminals"
});
but I get xml returned from my web service.
when I call my web service like so:
$.ajax(
{
type: "POST",
url: "SampleScriptService.asmx/GetAllTerminals",
data: '',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(result) {
var terminal = result.d;
console.log("got: " + result.d);
},
error: function(e) {
$("#testDiv").text("found error- " + e);
}
});
I get a json result:{"d":{"__type":"ICTS.SmartQueue.ManagementWebSite.sample.SampleScriptService+Harta","total":1,"page":1,"records":1,"rows":[{"__type":"ICTS.SmartQueue.Controllers.PresentationObjects.TerminalPO","TerminalId":2,"Name":"test terminal 1"}]}}
I'm probably doing something wrong with the jqgrid options, but I don't know what.
My second problem, you might have noticed already, is that i'm not sure what the format of the response should be.
inside the rows element- every row should have an 'id' element and 'cells' collection that contain all the cells?
thanks in advance,
Jhonny
Forum Timezone: Europe/Sofia
Most Users Ever Online: 715
Currently Online:
55 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