-
Notifications
You must be signed in to change notification settings - Fork 928
Open
Labels
Description
When handling onRowsDelete and returning false in an async function, the selected row still gets deleted even though it shouldn't
Expected Behavior
Returning false in an async function should prevent deletion of the selected row as the documentation stated
Current Behavior
Returning false in an async function still deletes the selected row anyway triggering the re-render state of the table.
Steps to Reproduce (for bugs)
handleDelete = async (rowsDeleted) => {
return false;
};
render() {
return(
<MUIDataTable
data={data}
columns={columns}
options={{
onRowsDelete: this.handleDelete,
responsive: 'scrollMaxHeight',
searchPlaceholder: 'Search...'
}}
/>
);
};
Will result in MUIDataTable deleting the selected row even though the return value is false.
When the handleDelete is not an async function, it works as expected.
Online example is here
Your Environment
Tech | Version |
---|---|
Material-UI-Core | ^4.9.9 |
Material-UI-Icon | ^4.9.1 |
MUI-datatables | ^2.14.0 |
React | ^16.12.0 |
Browser | Chrome Version 81.0.4044.129 (Official Build) (64-bit) |