Add pagination/search/sort to the admin tables that can grow large
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>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
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',
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -8,3 +8,4 @@ import 'bootstrap/js/dist/dropdown';
|
||||
import './game-waiting';
|
||||
import './game-lobby';
|
||||
import './admin-session-tabs';
|
||||
import './admin-datatables';
|
||||
|
||||
Reference in New Issue
Block a user