Search a value with parenthesis in Datatable search not giving the result
Search a value with parenthesis in Datatable search not giving the result
subhajit
Posts: 1Questions: 1Answers: 0
I have the following code which is used to create the datatble and filter the value, but when the value contains parenthesis then the search is not giving any result though value can be seen if I chose to see All.
initComplete: function () {
this.api().columns([1,2,3,4,5,6]).every(function () {
var column = this;
var select = $('<select style="width:130px; font-size: 13px;text-align-last: center; padding: 2px 1px 2px 1px; background: #fff; border: 1px solid #ccc; border-radius: 6px;position: relative; "><option value="">(All)</option></select>')
.appendTo($(column.footer()))
.appendTo( $(column.footer()).empty() )
.on('change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
alert("Asche::"+val);
column
.search(val ? '^' + val + '$' : '', true, false)
.draw();
});
column.data().unique().sort().each(function (d, j) {
select.append('<option style="text-align-last: right;" value="' + d + '">' + d + '</option>')
} );
} );
}
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
This discussion has been closed.
Answers
Your code seems to work here:
http://live.datatables.net/pifeniqe/1/edit
Search for
(System Architect)
and it shows the row with(System Architect)
.Please update the test case to replicate your issue.
Kevin