From 7a2d53631875ee74f4052d69dbdbab8d00520fb9 Mon Sep 17 00:00:00 2001 From: andrzej Date: Thu, 27 Jun 2024 16:08:14 +0200 Subject: [PATCH] enable row selection --- prisma/dev.db | Bin 69632 -> 69632 bytes src/app/ui/tables/data-table.tsx | 7 +++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/prisma/dev.db b/prisma/dev.db index b274d76b11d8088f94ea7ba1d82aef61b50ab620..77e4e7be444587006196a934e1af1bbd15fa2d41 100644 GIT binary patch delta 68 zcmV-K0K5Nypag)R1dtm6zL6Y50lu+dr2hyI2Q2^(u@7XG5CI+p2Q3FJvmp@w2DdE- a0fhtt4v4q33jx#u1ONa4+_#Jl0dxV`922hq delta 67 zcmV-J0KETzpag)R1dtm6ypbG30lcwbr2h;O2Q2^(u@7Vq7Y>M(3;`aqArSutw=D+& Zg#-cs0JpRY0n`EnfeZ%;w~P(}bOFtc6DR-x diff --git a/src/app/ui/tables/data-table.tsx b/src/app/ui/tables/data-table.tsx index 4a10277..215030e 100644 --- a/src/app/ui/tables/data-table.tsx +++ b/src/app/ui/tables/data-table.tsx @@ -26,7 +26,7 @@ import { getFilteredRowModel, getCoreRowModel, getPaginationRowModel, - useReactTable, + useReactTable } from "@tanstack/react-table" import { @@ -63,6 +63,8 @@ export function DataTable({ const table = useReactTable({ data, columns, + enableRowSelection: true, + enableMultiRowSelection: true, getCoreRowModel: getCoreRowModel(), getPaginationRowModel: getPaginationRowModel(), onSortingChange: setSorting, @@ -74,7 +76,7 @@ export function DataTable({ sorting, columnFilters, columnVisibility, - }, + } }) const pathname = usePathname() const [filterBy, setFilterBy] = useState(table.getAllColumns()[0]) @@ -174,6 +176,7 @@ export function DataTable({ key={row.id} data-state={row.getIsSelected() && "selected"} tabIndex={0} + onClick={() => row.toggleSelected()} > {row.getVisibleCells().map((cell) => (