resetOnQuickSaveFailed

This commit is contained in:
rickcole 2020-09-22 18:37:51 +08:00
parent 0fdc0ab42d
commit 048f34ef9a

View File

@ -173,6 +173,11 @@ export interface CRUDCommonSchema extends BaseSchema {
*/
quickSaveItemApi?: SchemaApi;
/**
*
*/
resetOnQuickSaveFailed?: boolean;
/**
* api
*/
@ -360,7 +365,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
filterTogglable: false,
filterDefaultVisible: true,
loadDataOnce: false,
loadDataOnceFetchOnFilter: true
loadDataOnceFetchOnFilter: true,
resetOnQuickSaveFailed: false
};
control: any;
@ -1055,7 +1061,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
primaryField,
env,
messages,
reload
reload,
resetOnQuickSaveFailed
} = this.props;
if (Array.isArray(rows)) {
@ -1110,7 +1117,9 @@ export default class CRUD extends React.Component<CRUDProps, any> {
reload && this.reloadTarget(reload, data);
this.search(undefined, undefined, true, true);
})
.catch(() => {});
.catch(() => {
resetOnQuickSaveFailed && this.control.reset();
});
}
}