Datatalbles: How to exclude specific row from filter?
-
I disabled the default search and i’m using a custom filter for my table. i want the first row of the table to always be displayed even if it doesn’t meet the filtering criteria. how do i do this? here’s my code:
jQuery(function($) {
$.fn.dataTable.ext.search.push(
function( settings, data, dataIndex ) {
var searchTerm = $(‘#searchBar’).val();
console.log(searchTerm)
var others = data[13]
var modelVerb = data[0]
if ( others.includes(searchTerm) || modelVerb.includes(searchTerm))
{
return true;
}
return false;
}
)
});jQuery(function($) {
$(document).ready(function() {
var table = $(‘#tablepress-10a’).DataTable({
dom: ‘l’,
paging: false,
ordering: false,
searching: true
});// Event listener to the filtering input to redraw on input
$(‘#searchBar’).keyup( function() {
table.draw();
});});
});
- The topic ‘Datatalbles: How to exclude specific row from filter?’ is closed to new replies.