Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

material-table edit/delete button change action

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.

like image 580
Mahendra Pratap Avatar asked Jan 01 '23 18:01

Mahendra Pratap


1 Answers

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)
          }
        ]}
      />
like image 163
cOkO Avatar answered Jan 07 '23 15:01

cOkO