View Full Version : Nested HasMany Associations

31 Jan 2012, 1:07 AM
So I'm not sure if I'm missing something obvious or I'm trying to do it wrong.

I have three models that each have a has many association to the model below it:
Site has many floors, floors have many nodes.

So I have a Site and I want to have a grid that has all the nodes associated with that site.

Is there any way of doing this? The only way I have thought of is to have an empty store and programatically add in the nodes.

Any help or suggestions would be appreciated.

31 Jan 2012, 7:02 AM
How are you wanting to display the associated data? The way I usually do it is use the RowExpander and you can show a child grid or a dataview. In fact, I built an extension a couple weeks ago to do this https://github.com/mitchellsimoens/Ux.grid.plugin.AssociationRowExpander

Am helping someone else here at Sencha do a TreePanel version but that one is proving to be more *fun*

31 Jan 2012, 10:21 AM
Thanks, that would solve my problem perfectly.

Just one more quick question. I want the grid to be empty until they pick a site through a dialog. Is there anyway to make an empty store to add to the grid. My current solution involves making a store and not loading it until the user has selected the site. Is there a better (less hacky) way to do this?