Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQgrid - escape ':' in searchoptions (value part)

Tags:

jqgrid

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.

thanks.

Edit: 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.

like image 331
bsr Avatar asked Jun 05 '10 17:06

bsr


1 Answers

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'"}

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

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

like image 162
Oleg Avatar answered Dec 15 '22 17:12

Oleg