In my data table, I am using column filtering. I am using this functionality through the data table init method and it is working fine. code is given below
initComplete: function() {
$('.dataTables_scrollBody thead tr').css({visibility:'collapse'});
var api = this.api();
api.columns().eq(0).each(function(colIdx) {
var cell = $('.myfilters th').eq($(api.column(colIdx).header()).index());
var cStyle = (cell.text() == 'Action') ? "display:none;" : "width:100%;color:black";
var title = "Search"
$(cell).html('<input type="text" style=' + cStyle + ' placeholder="' + title + '" />');
$('input', $('.myfilters th').eq($(api.column(colIdx).header()).index())).off('keyup change').on('keyup change', function(e) {
e.stopPropagation();
$(this).attr('title', $(this).val());
var regexr = '({search})';
alert(regexr)
var cursorPosition = this.selectionStart;
api.column(colIdx).search(this.value != '' ? regexr.replace('{search}', '(((' + this.value + ')))'): '', this.value != '', this.value == '').draw();$(this).focus()[0].setSelectionRange(cursorPosition, cursorPosition);
$('.dataTables_scrollBody thead tr').css({visibility:'collapse'});
});
});
},
});
how can I use search highlight in column filtering? how can I add highlight code here in column searching?