如何使用jqGrid在查询字符串周围添加单引号 [英] How to add single quotes around query string using jqGrid
问题描述
我正在使用jqGrid
向用户显示一些数据.我希望此网格可排序,但是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.
这是jqGrid现在发送的查询字符串:
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
但是我的服务需要它是
http://local/MyService.svc/GetData?_search=false&nd=1313069918597&rows=50&page=1&sidx='ColumnName'&sord='asc'
注意ColumnName
和asc
有大量的jqGrid选项,但我还没有发现任何可以让我以这种方式操纵querystring参数的东西.任何帮助深表感谢!
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!
推荐答案
有 serializeGridData 可能如下所示
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;
}
这篇关于如何使用jqGrid在查询字符串周围添加单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!