如何使用jqGrid在查询字符串周围添加单引号 [英] How to add single quotes around query string using jqGrid

查看:90
本文介绍了如何使用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'

注意ColumnNameasc

有大量的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆