Вот как я это делаю:
ngAfterViewInit() {
console.log('ContactsComponent - ngAfterViewInit()');
this.dtTrigger.next();
this.datatableElement.dtInstance.then((dtInstance: DataTables.Api) => {
dtInstance.columns().every(function () {
const that = this;
$('input', this.footer()).on('keyup change', function () {
console.log('search(): ' + that.search());
console.log('value: ' + this['value']);
if (that.search() !== this['value']) {
that.search(this['value'])
.draw();
}
});
});
});
В файле HTML добавьте нижний колонтитул с именем = search-yourfield:
<tfoot>
<tr>
<th>Sélection</th>
<th><input type="text" placeholder="Search ID" name="search-idaicontact"/></th>
<th><input type="text" placeholder="Search first name" name="search-identifiant"/></th>
<th><input type="text" placeholder="Search last name" name="search-nom"/></th>
<th><input type="text" placeholder="Search last name" name="search-prenom"/></th>
<th>Action</th>
</tr>
</tfoot>