This link has been bookmarked by 1 people . It was first bookmarked on 02 Sep 2008, by Mairon Croes.
-
02 Sep 08
Mairon CroesQuestion about using databinding (two way) or notifications for an arraycollection between model and view.
puremvc bestpractices guide forumposts development flex tipsntricks
-
Do I understand this right: Assume I have a DataGrid in my view component and an object in the Model that has an ArrayCollection object to represent the data. The view mediator component can retrieve the proxy for the data and obtain the model's ArrayCollection and set the DataGrid's dataProvider property, thus directly binding the model's ArrayCollection to the view's DataGrid for display?
Is that what you meant in this paragraph? Or should the View in this case actually have another ArrayCollection and when the View mediator receives notifications that the model's data has been updated the mediator should retrieve the contents of the model's ArrayCollection (via the proxy of course) and modify the contents of the view's ArrayCollection to match? -
Generally, we want the edits made at the DataGrid (or any visual control) to automatically update the Model, and in turn have other parts of the View informed of such changes if necessary.
-
The reason for simply retrieving the reference from the Proxy and setting it as the dataProvider for the visual control can just be filed under 'playing well with other frameworks'.
That is to say, Flex provides a wonderful solution for updating the data and dependent visual controls when changes happen. The ArrayCollection and XMLListCollections simply do the right thing.
If you happen to be using PureMVC with Flex, it'd be silly to repeat all that effort by adding methods and Notifications in the Proxy that duplicate what Collections are providing. Especially when those classes are going to be compiled into your app anyway if you just use them to hold data.
-
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.