Groups | Blog | Home
all groups > macromedia flash flash remoting > june 2004 >

macromedia flash flash remoting : prob changing data in datagrid result


dave66
6/15/2004 5:47:48 PM
I'm new to flash remoting and I'm trying to load the result set from a CFC
query into a datagrid (Flash MX 2004 Pro, using DataGrid UI component).

So far, I've been successful in doing this with one BIG problem. When I
attempt to modify the values in the datagrid, the datagrid reverts back to the
original value in the cell I just modified instead of the value I just keyed
in, as soon as I click on another cell. This does not happen if I use a
"hardwired" array instead of the result object as the datagrid dataProvider.

Can anybody tell me what I'm doing wrong?

Below is the actionscript I'm using to load the datagrid:

myQueryFunctionResponse.prototype.onResult = function(result) {
// id carries parameter value loaded at remote CFC invocation time
trace("The response came from the call with id " + this.id);

// setDeliveryMode is optional
result.setDeliveryMode("fetchall");

// this links the result RecordSet returned by Flash Remoting
// to a UI datagrid component

myArray = new Array();
myArray.push({US_ID:"11", US_FIRST_NAME:"Mike", US_LAST_NAME:"Smith"});
myArray.push({US_ID:"12", US_FIRST_NAME:"Susan", US_LAST_NAME:"Green"});
//myArray = result;

myDataGrid.dataProvider = myArray;
};

This works -- I can change values in the cells and they remain as modified.
But if I uncomment out the line near the bottom "myArray=result;" I have the
problem described.
denny1
6/17/2004 3:23:28 PM
Every time the datagrid cells are rolled over a function called setValue() is
called. This function is part of the UI Component Class.
Try this in your responder:

myArray = new Array();
for(var i=0; i<result.getLength(); i++){
myArray.us_first_name = result.items[ i ].us_first_name;
myArray.us_last_name = result.items[ i ].us_last_name;

//add the items to the array
myArray.addItem({us_first_name:myArray.us_first_name,
us_last_name:myArray.us_last_name});

myDataGrid.dataProvider = myArray;
};


AddThis Social Bookmark Button