make table clickable

This commit is contained in:
andrzej 2024-06-26 14:54:04 +02:00
parent b1de1477a6
commit 9c9b010dc1
1 changed files with 4 additions and 2 deletions

View File

@ -72,7 +72,6 @@ export function DataTable<TData, TValue>({
}, },
}) })
const pathname = usePathname() const pathname = usePathname()
const router = useRouter()
const [filterBy, setFilterBy] = useState(table.getAllColumns()[0]) const [filterBy, setFilterBy] = useState(table.getAllColumns()[0])
return (<> return (<>
<div className="flex justify-between py-4"> <div className="flex justify-between py-4">
@ -169,7 +168,10 @@ export function DataTable<TData, TValue>({
data-state={row.getIsSelected() && "selected"} data-state={row.getIsSelected() && "selected"}
> >
{row.getVisibleCells().map((cell) => ( {row.getVisibleCells().map((cell) => (
<TableCell key={cell.id}> <TableCell key={cell.id}
onClick={(e) => { console.log(`row: ${JSON.stringify(row.original)} cell: ${cell.id} ${JSON.stringify(e.timeStamp)}`) }}
>
{flexRender(cell.column.columnDef.cell, cell.getContext())} {flexRender(cell.column.columnDef.cell, cell.getContext())}
</TableCell> </TableCell>
))} ))}