Skip to content

How to get the data from selected key in table #2030

Answered by anopperl
ru-dr asked this question in Help
Discussion options

You must be logged in to vote

Hi, @ru-dr your table should have an id field and then get the id with selectedKeys

<div className="flex flex-col gap-3"> <Table aria-label="Rows actions table example with dynamic content" selectionMode="multiple" selectedKeys={selectedKeys} onSelectionChange={setSelectedKeys} > <TableHeader columns={columns}> {(column: any) => <TableColumn key={column.key}>{column.label}</TableColumn>} </TableHeader> <TableBody items={rows}> {(item: any) => ( <TableRow key={item.id} > {(columnKey) => <TableCell>{getKeyValue(item, columnKey)} </TableCell>} </TableRow> )} </TableBody> </Table> <p>{selectedKeys}</p> </div>

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ru-dr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants