Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > DataSet component > DataSet.resolveDelta | |||
Flash Player 7.
Flash MX Professional 2004.
Usage 1:
var listenerObject:Object= new Object();listenerObject.resolveDelta = function (eventObj:Object):Void { // ... };dataSetInstance.addEventListener("resolveDelta",listenerObject);
Usage 2:
on (resolveDelta) {
// ...
}
Event; broadcast when DataSet.deltaPacket is assigned a delta packet whose transaction ID matches that of a delta packet previously retrieved from the DataSet object, and that has messages associated with any of the deltas or DeltaItem objects contained by that delta packet.
This event gives you the chance to reconcile any error returned from the server while attempting to apply changes previously submitted. Typically, you use this event to display a "reconcile dialog box" with the conflicting values, allowing the user to make appropriate modifications to the data so that it can be re-sent.
The event object (eventObj) contains the following properties:
target The DataSet object that generated the event.
type The string "resolveDelta".
data An array of deltas and associated DeltaItem objects that have nonzero length messages.
The following example displays a form called reconcileForm (not shown) and calls a method on that form object (setReconcileData()) that allows the user to reconcile any conflicting values returned by the server:
import mx.data.components.datasetclasses.*;
my_ds.addEventListener("resolveDelta", onResolveDelta);
function onResolveDelta(eventObj:Object) {
reconcileForm.visible = true;
reconcileForm.setReconcileData(eventObj.data);
}
// in the reconcileForm code
function setReconcileData(data:Array):Void {
var di:DeltaItem;
var ops:Array = ["property", "method"];
var cl:Array;
// change list
var msg:String;
for (var i = 0; i<data.length; i++) {
cl = data[i].getChangeList();
for (var j = 0; j<cl.length; j++) {
di = cl[j];
msg = di.message;
if (msg.length>0) {
trace("The following problem occurred '"+msg+"' while performing a '"+ops[di.kind]+"' modification on/with '"+di.name+"' current server value ["+di.curValue+"], value sent ["+di.newValue+"] Please fix!");
}
}
}
}
Flash CS3