jqgrid post request data json
If I understand correct your problem you should use serializeGridData in about the following form:
serializeGridData: function(postData) {
return JSON.stringify(postData);
}
If you need send some additional data to the server you can use additionally
postData: {
dev_post_reqtype: "read",
dev_post_devndx: "1",
dev_post_reccount: "55"
}
or
postData: {
dev_post_reqtype: "read",
dev_post_devndx: 1,
dev_post_reccount: 55
}
depend on the type of dev_post_devndx
and dev_post_reccount
properties which you need (string or integer).
user954211
Updated on June 04, 2022Comments
-
user954211 almost 2 years
My grid data read is configured for use json format. This is the configuration
url:"devitem.json", mtype: "POST", datatype: "json", ajaxGridOptions: { type : 'post', async : false, error : function() { alert('Something bad happened. Stopping');}, }, jsonReader : { root : "rows", page : "page", total : "total", records : "records", repeatitems : true, cell : "cell", id : "0", userdata : "userdata", },
The read request from client send always parameters in this format:
_search=false&nd=1317286048991&rows=25&page=1&sidx=device_id&sord=asc&totalrows=100 How I can convert it to json format ?
I have also set the postData option
postData : JSON.stringify({"dev_post_reqtype":"read","dev_post_devndx":"1","dev_post_reccount":"55"}),
It work but obiuovsly cannot be changed
I have this problem with pager. For testing after change the page number I call this function
function DEVpager_event(pgevent) { var page = jQuery("#DEVtbl").getGridParam('page'); alert (pgevent+page) ; // changed devndx for test only var jdata = JSON.stringify({"dev_post_reqtype":"read","dev_post_devndx":"25","dev_post_reccount":"55"}) ;
jQuery("#DEVtbl").jqGrid('setGridParam', 'postData', jdata); } ;
page is changed with my selection but postData don't change thanks for help
-
gkd720 about 12 yearsThanks! Someone should mark this as the answer. It works as expected.