Proper way to inject unique data from a group of dynamically generated meditators.

Michael's Avatar

Michael

13 Nov, 2009 05:52 AM

Let's say that I have a single "parent" view. And based off of xml data the parent mediator will add numerous "child" views to its parent view display list. Whats the proper Robotlegs way of injecting unique data into the children views? I've only come up with these:

  1. Give each child view an unique id from the parent mediator at its creation. Then in the autoCreated child mediator, filter data based off the child view id. Only question then is how to correctly link the id to the view based off of xml data.

  2. Pass VO objects to the child views from the parent mediator at creation and have only the parent mediate for them. This cant be right.

  3. Would the mediator map's injectViewAs have anything to do with this, cant find any info on that feature.

Obviously I'm not sure what to do. Any suggestions? Thanks.

Lovely support site by the way.

  1. Support Staff 1 Posted by Joel Hooks on 13 Nov, 2009 06:03 AM

    Joel Hooks's Avatar

    Hi Michael,

    http://github.com/robotlegs/robotlegs-demos-Bundle/blob/master/Wher...

    You can see in this Model(Proxy) I am keeping a map of mediators. That was the purpose of this project, was to provide a mechanism for accessing a set of like mediators with a UID. The key is really to turn off the automatic mediation and control the creation of mediators via a command, this gives you the opportunity to manually inject whatever identifier you need to (such as the vo). So perhaps the command could create the views, inject the VO, mediate, and then send an event with the views in an array to be added to the parent via its mediator.

  2. 2 Posted by Michael on 13 Nov, 2009 06:15 AM

    Michael's Avatar

    Joel,

    Thank you! I didn't notice at first the other demos in the demos bundle besides the 6 in the live examples. This is perfect. Thanks again.

  3. Joel Hooks closed this discussion on 13 Nov, 2009 06:21 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac