Sort by name and keep disabled at the bottom.

This commit is contained in:
SergeantPanda 2025-05-04 21:43:30 -05:00
parent 43903a98a6
commit 852993149f
2 changed files with 21 additions and 2 deletions

View file

@ -276,7 +276,16 @@ const EPGsTable = () => {
const table = useMantineReactTable({
...TableHelper.defaultProperties,
columns,
data: Object.values(epgs),
// Sort data before passing to table: active first, then by name
data: Object.values(epgs)
.sort((a, b) => {
// First sort by active status (active items first)
if (a.is_active !== b.is_active) {
return a.is_active ? -1 : 1;
}
// Then sort by name (case-insensitive)
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
}),
enablePagination: false,
enableRowVirtualization: true,
enableRowSelection: false,

View file

@ -489,7 +489,17 @@ const M3UTable = () => {
const table = useMantineReactTable({
...TableHelper.defaultProperties,
columns,
data: playlists.filter((playlist) => playlist.locked === false),
// Sort data before passing to table: active first, then by name
data: playlists
.filter((playlist) => playlist.locked === false)
.sort((a, b) => {
// First sort by active status (active items first)
if (a.is_active !== b.is_active) {
return a.is_active ? -1 : 1;
}
// Then sort by name (case-insensitive)
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
}),
enablePagination: false,
enableRowVirtualization: true,
enableRowSelection: false,