PDA

View Full Version : Populating multiple GridPanels with subsets of data from a store



DaveKnell
12 Jun 2010, 5:51 AM
Hi -

Been banging my head on this, and would appreciate a bit of guidance. What I'm trying to do is:
- load some data into a JsonStore
- group it according to one of the fields
- display each group in a separate GridPanel, all held in a container.

The existing code to display one GridPanel in the tabPanel which I have (and which works fine) does things in a fairly sequential way - create the Store, create the GridPanel, create the container. However, the asynchronous nature of the store means that I'm not finding an obvious way to extend to more than one GridPanel.

I think I should:
- create the container
- create the Store
- add an on('load'..) handler to the store which does the filtering and adds the panels to the container
- issue a container.doLayout()

Am I right, or is there something that I've missed?

Thanks --

Dave

DaveKnell
12 Jun 2010, 8:07 AM
Following up to myself, that works as expected.

But I've now got another problem - five GridPanels in a Panel, and they're not expanding vertically to show the data in them - they each show about half a row.

The Panel's set with layout: 'auto'; changing this to 'fit' results in the first GridPanel expanding to fill the container, as expected, so a layout is, at least, being applied. I suspect that they're being rendered at their initial height (they're the same size as a test one with no data) and then not resizing when they work out that there's data there. That's with height: auto; using height: 200 (or whatever) works as expected.

So how do I get the things to resize themselves vertically according to the number of rows of data that they have?

--Dave