Uses simple-datatables (vanilla JS, no jQuery needed) on the Users, Sessions, Email Log, and Feedback tables, since those grow with real usage. Left Games (small, admin-curated) and Hints (row order is meaningful - "checked in order" - a sortable column would mislead) untouched. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
23 lines
884 B
JavaScript
23 lines
884 B
JavaScript
import { DataTable } from 'simple-datatables';
|
|
import 'simple-datatables/dist/style.css';
|
|
|
|
// Paginate/search/sort any admin table opted in via class="admin-datatable".
|
|
// Kept off tables that are admin-curated and stay small (games) or where row
|
|
// order is meaningful and must not be disturbed by sorting (hints).
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
document.querySelectorAll('table.admin-datatable').forEach((table) => {
|
|
new DataTable(table, {
|
|
perPage: 25,
|
|
perPageSelect: [10, 25, 50, 100],
|
|
searchable: true,
|
|
sortable: true,
|
|
labels: {
|
|
placeholder: 'Search...',
|
|
perPage: '{select} entries per page',
|
|
noRows: 'No matching entries found',
|
|
info: 'Showing {start} to {end} of {rows} entries',
|
|
},
|
|
});
|
|
});
|
|
});
|