diff --git a/frontend/src/components/tables/EPGsTable.jsx b/frontend/src/components/tables/EPGsTable.jsx index 6b6c9d79..38173e36 100644 --- a/frontend/src/components/tables/EPGsTable.jsx +++ b/frontend/src/components/tables/EPGsTable.jsx @@ -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, diff --git a/frontend/src/components/tables/M3UsTable.jsx b/frontend/src/components/tables/M3UsTable.jsx index adc420e2..44c79477 100644 --- a/frontend/src/components/tables/M3UsTable.jsx +++ b/frontend/src/components/tables/M3UsTable.jsx @@ -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,