Faceted filtering with live total/count — click values to filter, counts update in real time
| Artist | Title | Label | Year | Genre | Format | Rating |
|---|
Placed via layout: { topStart: 'searchPanes' }.
With serverSide: true, pane options come from the server response — DataTables expects a searchPanes.options object keyed by column name.
Selections are sent back as searchPanes[field][i] parameters.
Each option shows two numbers: total (unfiltered) and count (after current filters).
new DataTable('#table', {
serverSide: true,
layout: { topStart: 'searchPanes' },
columnDefs: [{
searchPanes: { show: true },
targets: [3, 4, 5, 6, 7] // label, year, genre, format, rating
}]
});
get_searchpanes_options() runs exactly two aggregations total — one for total (no filters) and one for count (current filters applied) — each using a single $facet stage to compute all pane columns at once.
Each option returns { label, value, total, count }.
When selections are active, they're applied as $in match conditions.
# Response includes:
{ "searchPanes": { "options": {
"genre": [
{ "label": "Rock", "value": "Rock",
"total": 312, "count": 312 },
{ "label": "Jazz", "value": "Jazz",
"total": 98, "count": 0 },
...
]
}}}