Functiondojo.data.api.Write.save

dojo.require("dojo.data.api.Write");
defined in dojo/data/api/Write.js

Saves to the server all the changes that have been made locally. The save operation may take some time and is generally performed in an asynchronous fashion. The outcome of the save action is is passed into the set of supported callbacks for the save.

Usage

function (/*Object*/ keywordArgs) (view source)
parametertypedescription
keywordArgsObjectonComplete: function onError: function scope: object } The *onComplete* parameter. function(); If an onComplete callback function is provided, the callback function will be called just once, after the save has completed. No parameters are generally passed to the onComplete. The *onError* parameter. function(errorData); If an onError callback function is provided, the callback function will be called if there is any sort of error while attempting to execute the save. The onError function will be based one parameter, the error. The *scope* parameter. If a scope object is provided, all of the callback function ( onComplete, onError, etc) will be invoked in the context of the scope object. In the body of the callback function, the value of the "this" keyword will be the scope object. If no scope object is provided, the callback functions will be called in the context of dojo.global. For example, onComplete.call(scope) vs. onComplete.call(dojo.global)

Examples

Example 1

store.save({onComplete: onSave});
store.save({scope: fooObj, onComplete: onSave, onError: saveFailed});