JQgrid-在searchoptions中转义':'(值部分) [英] JQgrid - escape ':' in searchoptions (value part)

查看:121
本文介绍了JQgrid-在searchoptions中转义':'(值部分)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此处链接文本.我有两个要求.
1.默认值必须为空.我希望,如果未设置defaultValue,则过滤器为空,但是在我的情况下不会发生这种情况.
2.如何在我的值中转义:".字符:"和;"用于分隔索引和值.但是,在我的值字符串中,它包含一个:"(例如:searchoptions:{value:"1:'Level:1'"},其中Level:1是我的第一个值).如何逃避:在价值部分.我尝试过\,/等

How to set the values for filter is explained here link text. I have two requirements.
1. the default value needs to be empty. I expect, if defaultValue is not set, the filter is empty, but that is not happening in my case.
2. How to escape ':' in my value. The character ':' and ';' are used to seperate the index and values. But, in my value string it contains a ':' (eg: searchoptions:{value:"1:'Level: 1'"} , where Level: 1 is my first value). How to escape : in the value part. I tried \ , / etc.

谢谢.

如果没有其他方法,则可以解决第1项.我可能会在值中设置其他项ALL,并将其默认使用.

Item 1 may be solved if there is no other way. I may set an additional item ALL in the values, and use it default.

推荐答案

您是正确的,如果像字符串一样定义,则不可能使用任何转义字符将':'放在searchoptionsvalue内:

You are right, it seems impossible to use any escape character to place ':' inside of value of searchoptions if you define it like a string:

searchoptions:{value:"1:'Level: 1'"}

还有searchoptionsvalue设置的另一种形式-对象形式,在

There is another form of setting of value of searchoptions - object form, which is also described under http://www.trirand.com/jqgridwiki/doku.php?id=wiki:search_config#colmodel_options. For example you can use following syntax

searchoptions:{value:{'1:': 'Level: 1;', ':2:;': 'Level: 2;'}}

它定义了一个带有文本"Level:1;"的选择.和等级:2;"将显示相应的值"1:"和:2 :;".可以.

It defines a select with the texts "Level: 1;" and "Level: 2;" displayed and the corresponding values "1:" and ":2:;". It works.

这篇关于JQgrid-在searchoptions中转义':'(值部分)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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