Escaped characters and the select filter
Escaped characters and the select filter

My test case shows filtering works with escaped characters, but the select value (current selection) doesn’t show because it defaults to the blank top value. Normal alphanumeric characters are fine and show as expected.
For example, the select filter under “Office” shows variations on New York with 3 containing a (.) (,) and (/). After selecting one of these the filter defaults to blank and the selected option is the only one in the drop down but but not appearing as the selected.
I’ve had some mixed success by replacing…
var val = $.fn.dataTable.util.escapeRegex($(this).val());
with var val = $(this).val();
but then certain characters didn’t show.
Is there a way around this or do I need to avoid anything other than alphanumeric characters if I’m going to apply a select filter to column?
This question has an accepted answers - jump to answer
Answers
You can unescape the string using something like this
currSearch.replace(/\\(.)/g, '$1')
. For example:http://live.datatables.net/rifonira/2/edit
Kevin
Thanks Kevin. That fixes the problem perfectly!