开发者

How to add single quotes around query string using jqGrid

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/MyServi开发者_开发技巧ce.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!


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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜