How to add single quotes around query string using jqGrid

ⅰ亾dé卋堺 提交于 2019-12-02 16:00:54

问题


I'm using jqGrid to display some data to users. I want this grid to be sortable, but the data jqGrid sends isn't exactly what I need.

Here is the query string jqGrid sends now:

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

But my service needs it to be:

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

Notice the single quotes around ColumnName and asc

There are tons of jqGrid options and I haven't found anything that allows me to manipulate the querystring parameters in this way. Any help is much appreciated!


回答1:


There are serializeGridData event/parameter of jqGrid which can help you solve any problems of customization of the server requests. In your case the serializeGridData could looks as following

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


来源:https://stackoverflow.com/questions/7027075/how-to-add-single-quotes-around-query-string-using-jqgrid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!