I have a list and A form that’s bound to it. When I save an item of the list with the form, the list updates, which in turn triggers its DataProcessor to send a request to the server. Everything up to this point works.
Now when there is an error on the server side, the server-side script sends back a JSON object with the correct ID of the (not) updated item and a status of “error” - like it’s documented. What I expected was that the list would show the old value because it knows that the update failed. What actually happened was nothing. So I tried to use the events of the DataProcessor (onBeforeSaveError and onAfterSaveError) to restore the old state of the item - without success. I could not access the old values or find a method that does it for me anywhere.
How can I revert the item back to its previous value? Wouldn’t it make sense for the list/DataProcessor to revert it automatically? Will it be implemented?
There is no undo|redo functionality. We have it in plans, but for now it is not supported.
There is no public API to get old values as well, list preserves only the latest state of items.
In your case, it possible to send the old values from the server side as part of response, or catch the event when record was selected in the list and save its value.
After adding a undo|redo functionality to the Webix, we will give an options to undo values after invalid server side operations.
Pulling the old values from the server is exactly what I’m doing right now. I see it more like a workaround, though. It requires to set up additional events and doesn’t automatically update the values in the form that’s bound to the list, so I had to do that as well.
Having the option to automatically revert changes after the server side execution failed is can be a big deal. I would really love that feature.