Question one:
I would approach this a little differently Rather than attempting to create a double-binding mechanism. Take advantage of the ModelLocator, and rework the target of the data update from the datagrid. The ItemEditor or after edit event should update the ModelLocator directly, rather than attempting to update the bound data item in the datagrid, this should automatically push the updated value back into the datagrid, giving the impression that it was updated directly in the datagrid.

ModelLocator
 - Send out Data to bound locations
 - Receive updated data

Data Display Item
 - Bind to ModelLocator
 - Update ModelLocator with new data


Regarding Question two:
A command could quite easily perform the item selection after the data update had been retrieved and correctly assigned to the ModelLocator

Hope this helps you some.
Graham Weldon

Larry Liang wrote:


As far as I know, in flex 2b3, if you use {} for data binding. it's a
one way binding: source = {destination}.

However, if you need the binding to work in two ways, do you do
another one but switch the source and destination? The reason I ask
this question is that in cairngorm, you can bind the dataprovider of
a datagrid to an arraycollection object inside ModelLocator. if you
make the datagrid editable, then when users make changes inside the
datagrid, you want the arraycollection object in modellocator to be
updated. but the databinding only works in one way.

In this case, if you bind the arrayobject inside modellocator to
datagrid provider, it makes the modellocator has to be aware of where
the view is.

I'm not sure what's the best way to solve this. please help me.

Another question of cairgorm, if i assign a remoting result (an
array) to the arraycollection object inside modellocator, the data
will be shown in the corresponding datagrid in my view. By default,
there is no row selected inside datagrid. if I want the first row to
be selected after the data is assigned to the datagrid, what's the
best way to achieve this? Should this be done by command class?
something like:

ModelLocator.getInstance().arrcollection = result;
myView.datagrid.selectedIndex = 1;

In this case, the command class needs to know where the view is. I don
't consider it as a good design. But do I have to use a view helper
in this case?

Thanks,

Larry


__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to