enable row selection

This commit is contained in:
andrzej 2024-06-27 16:08:14 +02:00
parent f163de99c8
commit 4aa7194427
2 changed files with 5 additions and 2 deletions

Binary file not shown.

View File

@ -26,7 +26,7 @@ import {
getFilteredRowModel,
getCoreRowModel,
getPaginationRowModel,
useReactTable,
useReactTable
} from "@tanstack/react-table"
import {
@ -63,6 +63,8 @@ export function DataTable<TData, TValue>({
const table = useReactTable({
data,
columns,
enableRowSelection: true,
enableMultiRowSelection: true,
getCoreRowModel: getCoreRowModel(),
getPaginationRowModel: getPaginationRowModel(),
onSortingChange: setSorting,
@ -74,7 +76,7 @@ export function DataTable<TData, TValue>({
sorting,
columnFilters,
columnVisibility,
},
}
})
const pathname = usePathname()
const [filterBy, setFilterBy] = useState(table.getAllColumns()[0])
@ -174,6 +176,7 @@ export function DataTable<TData, TValue>({
key={row.id}
data-state={row.getIsSelected() && "selected"}
tabIndex={0}
onClick={() => row.toggleSelected()}
>
{row.getVisibleCells().map((cell) => (
<TableCell key={cell.id}>