Why wouldn’t it be
currentModel[changedColumnName] = myItem[changedColumnName]?
Matt
From: Jonathan Hirschi
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 06, 2005
11:48 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] dynamic
assignment?
hey guys, I'm trying to figure out how to do some
dynamic assignement to an object... and I'm not
sure
about how to do it...
basically, I have a datagrid that gets information
from a cfc. This datagrid is editable
(several
fields) and I want to track changes on the
datagrid
one row at a time, and I want to commit updates
when
the selection of the row changes. So what I've
done is
to create an object that has names that match the
columns in the datagrid.. then i copy over changes
each time the column changes.
ala:
currentModel = new Object;
currentModel.IROW= 0;
currentModel.ICOLUMN= 0;
currentModel.ICOLSPAN= 0;
function
sendUpdate(event:Object,myItem:Object):Void
{
var changedColumnName:String;
var myCol:Object;
if (mySelectedIndex !=
event.itemIndex) {
doUpdate();
}
//changedColumnName = columnList
event.columnIndex].columnName; // this is the name
of
the column that was edited
// this updates the current model so that it
reflects
the current state of things.
currentModel[myCol.ColumnName] =
myItem[myCol.ColumnName];
^^^^^^^^^^^^
the line above is where i'm trying to dynamically
map
the fields from the datagrid to the object.
the
fields have the same name, but this doesn't seem
to
work.
Anyone have any pointers on how to do it?
Thanks!
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com
Yahoo! Groups Links
|