Sys.Data.DataService.update Method
Updates data through a data service.
Syntax
update: function(item, resourceUri, succeededCallback, failedCallback, userContext, provideReturnData)
Usage
var a = exampleDataService.update(item, resourceUri, succeededCallback, failedCallback, userContext, provideReturnData);
|
Parameter
|
Definition
|
|
item
|
A JavaScript object with the modified data.
|
|
resourceUri
|
(Optional) The resource URI of the data item to update.
|
|
succeededCallback
|
(Optional) The function to execute when the update operation succeeds.
|
|
failedCallback
|
(Optional) The function to execute when the update operation fails.
|
|
userContext
|
(Optional) The state object for this operation.
|
|
provideReturnData
|
(Optional) true if the data service should return the updated data to the callback function; otherwise, false.
|
Return Value
The Sys.Net.WebRequest object that performed the update operation.
Remarks
Use the update method to modify existing data through a data service. The update method immediately executes a single update operation. If you must execute more than one operation as a single batch, use the createActionSequence method.
You pass the data to update as a Javascript object in the item parameter.The Boolean provideReturnData parameter enables you to specify whether the updated data is returned from the method. The updated data might differ from what you passed to the method if a trigger or some other code has modified the data.
The signatures for the callback functions should be similar to the following code:
function callbackSucceeded(result, context, operation)
function callbackFailed(error, context, operation)
The functions you assign to the callback functions must accept three parameters. The first parameter contains the result (or error) returned by the data service. The second parameter contains the state object for the data operation. The third parameter contains a description of the operation that was performed. For update operations, the third parameter contains update.
Caution
The update method does not evaluate the provideReturnData parameter in the December CTP release. The method uses a default value of false. The data service never returns the data to the callback function.
This topic is ASP.NET Extensions documentation and is unsupported by Microsoft. Blank topics are included as placeholders and existing content is subject to change in future releases.