From 6fe6b47491040040caff0c5a29ebb733fa321e5b Mon Sep 17 00:00:00 2001 From: Quentin AUBERT Date: Thu, 8 Aug 2024 12:23:05 +0200 Subject: [PATCH] Update Table component to have a default sort & setup default sort for TeamApiSubscriptions --- .../src/components/backoffice/apis/TeamApiSubscriptions.tsx | 2 +- daikoku/javascript/src/components/inputs/Table.tsx | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/daikoku/javascript/src/components/backoffice/apis/TeamApiSubscriptions.tsx b/daikoku/javascript/src/components/backoffice/apis/TeamApiSubscriptions.tsx index 36cc2e644..a235994d5 100644 --- a/daikoku/javascript/src/components/backoffice/apis/TeamApiSubscriptions.tsx +++ b/daikoku/javascript/src/components/backoffice/apis/TeamApiSubscriptions.tsx @@ -520,7 +520,7 @@ export const TeamApiSubscriptions = ({
{ if (subscriptionsQuery.isLoading || subscriptionsQuery.error) { diff --git a/daikoku/javascript/src/components/inputs/Table.tsx b/daikoku/javascript/src/components/inputs/Table.tsx index aefd4dfd9..3a97297eb 100644 --- a/daikoku/javascript/src/components/inputs/Table.tsx +++ b/daikoku/javascript/src/components/inputs/Table.tsx @@ -68,6 +68,7 @@ const TableComponent = (props: TableProps, ref: React.Ref< const { translate } = useContext(I18nContext); + console.debug({ id: props.columns[0].id!, desc: false, col: props.columns[0] }) const table = useReactTable({ data: items, columns: props.columns, @@ -82,6 +83,11 @@ const TableComponent = (props: TableProps, ref: React.Ref< getFacetedRowModel: getFacetedRowModel(), getFacetedUniqueValues: getFacetedUniqueValues(), getFacetedMinMaxValues: getFacetedMinMaxValues(), + initialState: { + sorting: [ + {id: props.defaultSort || "", desc: !!props.defaultSortDesc} + ] + } });