mirror of
https://github.com/Sosokker/B2D-Ventures.git
synced 2025-12-18 21:44:06 +01:00
feat: add pagination state management to DataTable component
This commit is contained in:
parent
4f36f3f7fb
commit
52204c4a6f
@ -176,6 +176,10 @@ export function DataTable({ data }: { data: ModalProps[] }) {
|
||||
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>([]);
|
||||
const [columnVisibility, setColumnVisibility] = React.useState<VisibilityState>({});
|
||||
const [rowSelection, setRowSelection] = React.useState({});
|
||||
const [pagination, setPagination] = React.useState({
|
||||
pageIndex: 0, //initial page index
|
||||
pageSize: 5, //default page size
|
||||
});
|
||||
|
||||
const table = useReactTable({
|
||||
data,
|
||||
@ -187,15 +191,16 @@ export function DataTable({ data }: { data: ModalProps[] }) {
|
||||
getSortedRowModel: getSortedRowModel(),
|
||||
getFilteredRowModel: getFilteredRowModel(),
|
||||
onColumnVisibilityChange: setColumnVisibility,
|
||||
onPaginationChange: setPagination,
|
||||
onRowSelectionChange: setRowSelection,
|
||||
state: {
|
||||
sorting,
|
||||
columnFilters,
|
||||
columnVisibility,
|
||||
rowSelection,
|
||||
pagination,
|
||||
},
|
||||
});
|
||||
console.table(columnVisibility)
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user