View Full Version : Load form data + dynamic elements

6 Oct 2011, 12:38 PM

I'm trying to figure out what the best way is to load data in my container. Until now I have been consistently loading the data via the form. Although this works fine, I recently was confronted with some dynamic elements which suddenly complicated my all too familiar form loading.

In the scenario I'm now confronted with I either have to load data from entity A or data from entity B. The choice depends on an attribute that knows about the type. So based on this type the items of my container must load either the items for entity A or entity B (hope you can follow me here).

I kind of wonder how to do this with loading the data via the form ? Note that the container doesn't know which entity to display until the data has been loaded. Wouldn't I therefore have to interpret the data first as to populate the container with the right components ?

As a workaround - maybe a good solution - I can imagine that I wait for the store to be loaded, and once this has happened I start populating the container with elements based on the loaded data. In this case I will not load via the form, but set the values on each component at the moment they're added to their container. Is this a viable alternative ?

Any suggestion or alternative is highly welcomed.