Use the per-column filters and the global search box. Hits from both are highlighted (default behavior).
| Name | Department | Notes | Created |
|---|---|---|---|
| svc_backup | IT | Nightly backup job for Alpha cluster | 2025-01-01 |
| svc_deploy | IT | Bravo rollout — app servers | 2025-01-02 |
| alice | HR | Onboarding: Alpha / Bravo / Charlie | 2025-01-03 |
| bob | Finance | Quarterly report for Bravo region | 2025-01-04 |
| svc_sql | DBA | SQL maintenance window – Alpha and Delta | 2025-01-05 |
| carol | IT | Incident review: gamma outage | 2025-01-06 |
Highlights terms from both the global search box and per-column filters (includeColumnSearch: true).
var table = $('#demoSearchHighlighterColumns').DataTable({
orderCellsTop: true,
searching: true,
searchHighlighter: {
includeColumnSearch: true,
minLength: 2,
hitStyle: {
backgroundColor: '#f3d9fa',
textColor: '#2b0a3d',
css: { 'border-radius': '3px', 'padding': '0 2px' }
}
}
});
// Bind per-column search boxes (second header row).
$('#demoSearchHighlighterColumns thead tr:eq(1) th').each(function (i) {
var input = $('input', this);
if (!input.length) return;
input.on('keyup change clear', function () {
if (table.column(i).search() !== this.value) {
table.column(i).search(this.value).draw();
}
});
});