material-table-core / core

Datatable for React based on material-ui's table with additional features. Support us at https://opencollective.com/material-table-core

Home Page:https://material-table-core.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

onRowUpdateCancelled doesn't return any rowData information

KippWade opened this issue · comments

Issue
When cancelling a row edit, the OnRowUpdateCancelled function rowData always returns undefined.
This seems to have never returned anything, even since the mbrn days.

Sandbox link
https://codesandbox.io/p/sandbox/material-table-issue-onrowupdatecancelled-vz4r6z

Expected behavior
Since rowData is shown in the Editable example, it is expected that the rowData would be available.
https://material-table-core.github.io/demos/edit/editable

Screenshots
image

Desktop:

  • OS: Windows 10
  • Browser : Chrome
  • Version: 120.0.6099.110 (Official Build) (64-bit)

Ah yes, it will be removed from the example in the future.

So, the workaround will still have to be:

                components={{
                    EditRow: (props) => {
                        return (
                            <MTableEditRow
                                {...props}
                                onEditingCanceled={(mode: any, rowData: any) => {
                                    // do stuff here
                                    props.onEditingCanceled(mode);
                                }}
                            />
                        );
                    },
                }}

We were hoping that this prop was intended to not have to do that...

Ah you mean the whole object, not the rowData key from the object.

That can easily be returned, in my opinion. Would you mind creating a PR with the change to onEditingCanceled material-table.js?

I imagine that onRowAddCancelled has the same issue, but we haven't had a need for that one...

I will attempt to make a PR here shortly.

Done and relased. Thanks