Skip to content

Commit

Permalink
fix: prevent enter to save for invalid row
Browse files Browse the repository at this point in the history
  • Loading branch information
Domino987 committed Nov 1, 2021
1 parent 849fdc6 commit 905d525
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/MTableEditRow/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,15 @@ function MTableEditRow(props) {
});
return mapArr;
}
const isValid = props.columns.every((column) => {
const error = validateInput(column, state.data);
return error.isValid;
});

const handleSave = () => {
if (!isValid) {
return;
}
const newData = state.data;
delete newData.tableData;
props.onEditingApproved(props.mode, state.data, props.data);
Expand All @@ -152,10 +159,6 @@ function MTableEditRow(props) {
...MTableEditRow.defaultProps.localization,
...props.localization
};
const isValid = props.columns.every((column) => {
const error = validateInput(column, state.data);
return error.isValid;
});
const actions = [
{
icon: props.icons.Check,
Expand Down

0 comments on commit 905d525

Please sign in to comment.