Forum
Topic RSS
10:53
If you're going to be posting JSON you're probably better of using a custom data function like this..
setup your grid with the datatype option set as
and here is the function.... note the params object which is what i send JSONified to my webservice... which can be anything you want... and in my case the data that gets sent is...
see how they match my "params" object ...
var params = new Object();
params.page = pdata.page;
params.pageSize = pdata.rows;
params.sortIndex = pdata.sidx;
params.sortDirection = pdata.sord;
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "YourWebservice.asmx/GetGridData",
data: JSON.stringify(params),
dataType: "json",
success: function(data, textStatus) {
if (textStatus == "success") {
var thegrid = $("#YourGrid")[0];
thegrid.addJSONData(data.d);
}
},
error: function(data, textStatus) {
alert('An error has occured retrieving data!');
}
});
}
12:08
Matthew said:
If you're going to be posting JSON you're probably better of using a custom data function like this..
setup your grid with the datatype option set as
datatype : function(pdata) { getData(pdata); }and here is the function…. note the params object which is what i send JSONified to my webservice… which can be anything you want… and in my case the data that gets sent is…
{”page”:1,”pageSize”:25,”sortIndex”:”id”,”sortDirection”:”desc”}see how they match my “params” object …
function getData(pdata) {
var params = new Object();
params.page = pdata.page;
params.pageSize = pdata.rows;
params.sortIndex = pdata.sidx;
params.sortDirection = pdata.sord;$.ajax({
type: “POST”,
contentType: “application/json; charset=utf-8″,
url: “YourWebservice.asmx/GetGridData”,
data: JSON.stringify(params),
dataType: “json”,
success: function(data, textStatus) {
if (textStatus == “success”) {
var thegrid = $(”#YourGrid”)[0];
thegrid.addJSONData(data.d);
}
},
error: function(data, textStatus) {
alert('An error has occured retrieving data!');
}
});
}
Hi Jason,
I've got the format for sending the data to the grid. I'm wanting to know what format the data is sent to the server.
TIA!
Sloan
10:49
Matthew said:
Mmm my post tells you one of the available formats…
btw who is Jason O_o
Sorry 'bout that Matthew!, must have been cranial flatulance on my part.
I must be confused. In reading your post above, it appeared to be just the format to send to the server. I'm an ASP (classic) programmer, so the PHP examples haven't helped. I guess I'm wondering how the submit to the ASP program will look. For instance, what is the name of the submitted info in the request object? How do the rows appear when saving data from the grid?
My guess from your example is that I'll get a form value for each of the parameters (i.e. page, pagesize, sortiindex, and sortdirection) If I specify each column in a row, will I receive a form value for "row", and then the fields in the row?
Thanks for your patience!
Sloan
Most Users Ever Online: 994
Currently Online:
44 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
Log In
Home
Offline