Skip to content

Commit

Permalink
Update Table component to have a default sort & setup default sort fo…
Browse files Browse the repository at this point in the history
…r TeamApiSubscriptions
  • Loading branch information
quentinovega committed Aug 8, 2024
1 parent a985958 commit 6fe6b47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ export const TeamApiSubscriptions = ({
</div>
<div className="col-12">
<Table
defaultSort="name"
defaultSort="adminCustomName"
columns={columns(usagePlans)}
fetchItems={() => {
if (subscriptionsQuery.isLoading || subscriptionsQuery.error) {
Expand Down
6 changes: 6 additions & 0 deletions daikoku/javascript/src/components/inputs/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const TableComponent = <T extends unknown>(props: TableProps<T>, 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,
Expand All @@ -82,6 +83,11 @@ const TableComponent = <T extends unknown>(props: TableProps<T>, ref: React.Ref<
getFacetedRowModel: getFacetedRowModel(),
getFacetedUniqueValues: getFacetedUniqueValues(),
getFacetedMinMaxValues: getFacetedMinMaxValues(),
initialState: {
sorting: [
{id: props.defaultSort || "", desc: !!props.defaultSortDesc}
]
}
});


Expand Down

0 comments on commit 6fe6b47

Please sign in to comment.