Hi Laurin,
Thanks for contacting Syncfusion support.
Query: I want to change the value of a state-variable when an error occurs (actionFailure event gets hit), however this crashes my edit dialog window (see following screenshot).
By default, React components are automatically re-rendered based on the state value change. In this cause, Grid component is also forced to re-render. So the Grid previous state neglect in this process. So, when you perform CRUD actions, we suggest you complete the CRUD action or cancel it before you are changing the state variable in your Grid application.
For your convenience we have attached the sample, please refer them for your reference.
Code Example:
|
Index.js
const actionFailure = args => {
console.log(args);
grid.closeEdit(); // as the edit operation failed, we have closed the dialog before changing the sate variable
setShowError(true);
};
|
Note: in the above sample the API service is not handled the CRUD service in the server side. So, the actionFailure event is triggered when you tried to save the record.
Please get back to us if you need further assistance.
Regards,
Ajith G.