|
|
|
|
|
by raganwald
5601 days ago
|
|
The idea of bindings is the same as you're describing, however I don't understand what you mean by donuts being objects mapping to an HTML representation. In MVC style, a donut model shouldn't know anything about its HTML representation, and there's a 1-* relationship between models and views on those models. For example, you might have one view of a donut that shows its picture, and another view that shows its ingredients. When displaying a collection, you do want the collection to manage whether to display these things using an HTML list or table or lightbox picture browser or whatever. But each donut should be a model that knows what it is to be a donut but not how donuts are displayed, each donut view to know how to display a donut, and the collection view knows how to organize what each individual donut view renders. The other reason you need a view for each donut is that you might want interactivity. For example, if you want a zoom control for a donut picture, that logic would go in the donut view. The donut collection view knows about scrolling, paging, whatever but not zooming. The donut view knows about zooming. And donuts know about sugar and flour and chocolate and sprinkles. |
|
In Flex, this is managed by a 2-part view consisting of the collection view (List) and the item view (ItemRenderer). When creating the List you pass it its data provider (oft. ArrayCollection) and its ItemRenderer.
Perhaps this example could benefit from a similar separation.