How a change the default input search?
How a change the default input search?
rodz25
Posts: 1Questions: 1Answers: 0
I need implement a change on serach to retorn any term tha I input separated by commas.
I tryed use:
$('#myInput').on( 'keyup', function () {
var searchString = $(this).val();
var searchTerms = searchString.split(',');
var regexString = searchTerms.map(term => (?=.*${term})
).join('');
table.search(regexString, true, false).draw();
} );;
and change the "my input" to "#myTable_filter label input" but dident worked.
Answers
You can't just repurpose the search input, without disabling the existing behaving first. This example here is doing that, it uses
off()
to prevent the standard search - try doing that first.Colin
I'd suggest you remove the default
input
element and replace it with your own. The other option would be to unbind DataTables event listeners on that element and then add your own, but I think simply replacing the element would be the easiest option.Allan