PDA

View Full Version : Formbinding with one-to-many in a grid



MartinElkjaer
28 Aug 2009, 2:55 AM
Hi,

I have a model like this:

Person - Profile -< Injury
(Person has one profile - and profile has one or more injuries)


I have a grid showing all the users - works fine.
And I have a formpanel showing properties from the profile object by using a formbinding object - also works nice.

The tricky part for me is: How can I show injuries in a grid in my formpanel using the formbinding ?

The best solution I can come up with is to add two listeners to the formbinding instance:
Events.BIND : When fired add the injury items to a ListStore and use this liststore for the grid.
Events.UNBIND: When fired add the element from the liststore to the injury collection on the profile object.

Is this the best solution ?? Please held :-)


Best regards
Martin