Material-table: Add a handler `onRowEdit` and `onRowEditCancel`

Created on 3 Jul 2019  路  6Comments  路  Source: mbrn/material-table

For when editable objects are provided...

Is your feature request related to a problem? Please describe.
I check for errors when validating input data on editing or adding new items. Those errors I want to clear when the editing is canceled.

Describe the solution you'd like
There is already some nice handlers as onOrderChange or onRowClick. I would like to have an additional handler onRowEdit when editing is started and onRowEditCancel when the X is pressed in editing mode.

Additional context
Also, I think it makes great sense to have a handler for when the detailPanel is opened/closed.

feature wontfix

Most helpful comment

@waisbek see my answers on https://github.com/mbrn/material-table/issues/751 though I wasn't able to get access to is editing

All 6 comments

I am also searching for a way to do this. I also couldn't manage to successfully override editrow component to get the functionality as there is no documentation on how to do this.

It's a great idea, I also need identify when the user is editing.

@waisbek see my answers on https://github.com/mbrn/material-table/issues/751 though I wasn't able to get access to is editing

Internally there is the 'onEditingCanceled' event. It just has to be exposed to the outside.
This would make external messaging way easier if we know when cancel was pressed.

I've stumbled upon this issue due to needing functionality to handle a user message when quitting the page with unsaved data. I've made the PR providing a callback that will be called with a boolean indicating a "isEditing" status.
You can try it out installing it like this npm install git://github.com/Rombusevil/material-table.git#onEditingStatusChange-build --save

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

Was this page helpful?
0 / 5 - 0 ratings