save

This method sends ready-to-save data changes to the server (normally using server.set, unless it's undefined, then with server.create) For a store with idProperty defined when the value of that property is falsy and allowCreate=true, uses server.create instead.

It returns a Promise which resolves (after server responds with the result and the model is updated) with true if save was actually performed (with errors or not) and false if save was skipped (i.e. no changes since last save or refresh or no changes ready to be sent as they failed validation or create is needed but allowCreate is false).

IMPORTANT: Both manual calls to save() and the auto-save facility will send all changed data properties that are not in error, regardless of whether other properties failed validation and model.status.canSave is false.

This method is often set up to run when user navigates away from the form (i.e. componentWillUnmount) or the app is paused so the user's work is saved.

Calls to save() while one is in progress are queued.

Note that FormStore does not have any built-in timeout facilities - it's up to the server.set/create methods to reject if no response is received from the server within some reasonable period of time.

FormStore instance save() method takes a single optional Object-type argument - saveOptions.

saveOptions

You can include additional properties in saveOptions for use by the beforeSave callback, which receives the entire saveOptions object as its third argument.

Last updated