Reputation: 3613
I'm using material-table in react js https://material-ui.com/components/tables/#material-table
I need to redirect the user to a separate edit page for the item.
I don't understand how to redirect to the edit page.
Upvotes: 4
Views: 12288
Reputation: 316
You can use the "actions" property as described in their documentation: https://material-table.com/#/docs/features/actions
<MaterialTable
...
actions={[
{
icon: 'edit',
tooltip: 'Edit User',
onClick: (event, rowData) => alert('You are editing ' + rowData.name)
},
{
icon: 'delete',
tooltip: 'Delete User',
onClick: (event, rowData) => confirm('You want to delete ' + rowData.name)
}
]}
/>
Upvotes: 9
Reputation: 170
You can use <TableCell>
as mentioned in the documentation and can create custom onClick method to open the action in new page.
https://material-ui.com/components/tables/#sorting-amp-selecting
Upvotes: 0