How to add single quotes around query string using jqGrid

I use jqGrid to display some data to users. I want this grid to be sortable, but jqGrid data is not sent exactly what I need.

Here is the jqGrid query string sending now:

 http://local/MyService.svc/GetData?_search=false&nd=1313069918597&rows=50&page=1&sidx=ColumnName&sord=asc 

But my service needs the following:

 http://local/MyService.svc/GetData?_search=false&nd=1313069918597&rows=50&page=1&sidx='ColumnName'&sord='asc' 

Note the single quotes around ColumnName and asc

There are many jqGrid options, and I did not find anything that would allow me to manipulate the querystring parameters this way. Any help is much appreciated!

0
source share
1 answer

There is a serializeGridData event / jqGrid parameter that will help you solve any problems with tuning server requests. In your case, serializeGridData might look like this

 serializeGridData: function (postData) { var myPostData = $.extend({}, postData); // make a copy of the input parameter myPostData.sidx = "'" + myPostData.sidx + "'"; myPostData.sord = "'" + myPostData.sord + "'"; return myPostData; } 
+2
source

Source: https://habr.com/ru/post/894973/


All Articles