enable row selection
This commit is contained in:
parent
9bf60c2282
commit
7a2d536318
BIN
prisma/dev.db
BIN
prisma/dev.db
Binary file not shown.
|
@ -26,7 +26,7 @@ import {
|
||||||
getFilteredRowModel,
|
getFilteredRowModel,
|
||||||
getCoreRowModel,
|
getCoreRowModel,
|
||||||
getPaginationRowModel,
|
getPaginationRowModel,
|
||||||
useReactTable,
|
useReactTable
|
||||||
} from "@tanstack/react-table"
|
} from "@tanstack/react-table"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -63,6 +63,8 @@ export function DataTable<TData, TValue>({
|
||||||
const table = useReactTable({
|
const table = useReactTable({
|
||||||
data,
|
data,
|
||||||
columns,
|
columns,
|
||||||
|
enableRowSelection: true,
|
||||||
|
enableMultiRowSelection: true,
|
||||||
getCoreRowModel: getCoreRowModel(),
|
getCoreRowModel: getCoreRowModel(),
|
||||||
getPaginationRowModel: getPaginationRowModel(),
|
getPaginationRowModel: getPaginationRowModel(),
|
||||||
onSortingChange: setSorting,
|
onSortingChange: setSorting,
|
||||||
|
@ -74,7 +76,7 @@ export function DataTable<TData, TValue>({
|
||||||
sorting,
|
sorting,
|
||||||
columnFilters,
|
columnFilters,
|
||||||
columnVisibility,
|
columnVisibility,
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const [filterBy, setFilterBy] = useState(table.getAllColumns()[0])
|
const [filterBy, setFilterBy] = useState(table.getAllColumns()[0])
|
||||||
|
@ -174,6 +176,7 @@ export function DataTable<TData, TValue>({
|
||||||
key={row.id}
|
key={row.id}
|
||||||
data-state={row.getIsSelected() && "selected"}
|
data-state={row.getIsSelected() && "selected"}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
|
onClick={() => row.toggleSelected()}
|
||||||
>
|
>
|
||||||
{row.getVisibleCells().map((cell) => (
|
{row.getVisibleCells().map((cell) => (
|
||||||
<TableCell key={cell.id}>
|
<TableCell key={cell.id}>
|
||||||
|
|
Loading…
Reference in New Issue