jqGrid filter issue with special characters after reload

242 Views Asked by At

We have jqGrid table that saves table display (ex. filtering) to DB so that when user visits the site again, the previous display was retained.

Filtering with special characters is OK when page is not reloaded. However, if it is saved with special characters (ex. \b), incorrect characters are displayed after page reload.

For example, when filtering "\b", displayed on filter toolbar after reload is only "b" (when checked via F12, the value from server is correct which is "\b" but when checked on HTML, value="b"). So we thought that the issue might be on setting the HTML.

We have tried using "autoencode" just incase it can help but still no luck.

Is anyone familiar of what might be causing the problem?

Thanks in advance.

1

There are 1 best solutions below

0
Tony Tomov On

If you search by escape character - by example "\b" actually jqGrid build the following search string which is send to the server:

filters: {"groupOp":"AND","rules":[{"field":"ShipName","op":"cn","data":"\\b"}]}

As can be seen the search word has a double " \\ " . In order to have correct search you will need to send a \\b to the grid - i.e save it correct in your database.

In all other cases, please provide a working demo which demonstrates the problem.

In order to demonstrate this problem you should write here in this post triple \ to display correct two \ characters.