mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
chore(FE-43): add sorting and setSorting props
This commit is contained in:
@@ -11,6 +11,8 @@ import {
|
||||
useReactTable,
|
||||
ColumnDef,
|
||||
FilterFn,
|
||||
SortingState,
|
||||
OnChangeFn,
|
||||
} from '@tanstack/react-table';
|
||||
import { rankItem } from '@tanstack/match-sorter-utils';
|
||||
import { Icon } from '@iconify/react';
|
||||
@@ -43,6 +45,8 @@ export interface TableProps<TData extends object> {
|
||||
onFuzzySearchValueChange?: (value: string) => void;
|
||||
className?: TableClassNames;
|
||||
emptyContent?: ReactNode;
|
||||
sorting?: SortingState;
|
||||
setSorting?: OnChangeFn<SortingState>;
|
||||
}
|
||||
|
||||
const DUMMY_SKELETON_DATA = [{}, {}, {}, {}, {}];
|
||||
@@ -78,6 +82,8 @@ const Table = <TData extends object>({
|
||||
paginationClassName: '',
|
||||
},
|
||||
emptyContent = emptyContentDefaultValue,
|
||||
sorting,
|
||||
setSorting,
|
||||
}: TableProps<TData>) => {
|
||||
const isServerSideTable =
|
||||
totalItems !== undefined &&
|
||||
@@ -105,9 +111,11 @@ const Table = <TData extends object>({
|
||||
getSortedRowModel: getSortedRowModel(),
|
||||
getPaginationRowModel: getPaginationRowModel(),
|
||||
onPaginationChange: setPagination,
|
||||
onSortingChange: setSorting,
|
||||
state: {
|
||||
pagination,
|
||||
globalFilter: fuzzySearchValue,
|
||||
sorting,
|
||||
},
|
||||
filterFns: {
|
||||
fuzzy: fuzzyFilter,
|
||||
|
||||
Reference in New Issue
Block a user