PDA

View Full Version : Same Store, different grids



JulianB
27 Aug 2012, 12:39 AM
Hello everyone,

i currently try to do the following:

Create a TabPanel with a dynamic number of gridpanels inside.
All these grids will show a list of people.
(A grid for people of type "A", another one for people of type "B" etc.)

Is it possible to have only one store, where all people are included and have the grid filter the content of the store according to the type of people it should display?

I know i could use grouping inside one grid, but thats not what I want ;-)


Kind regards,
Julian

Farish
27 Aug 2012, 12:57 AM
you can filter the store on tabchange event of the tabpanel and then filter for the type you want for the grid in that tab e.g.


tabpanel.on('tabchange', function() {
// switch for type or use if-else
store.filter("type", "A");
});

JulianB
27 Aug 2012, 1:09 AM
Does this mess with the filters applied by the user (via pagingToolbar or custom filters on the fields (via column header)?

Best would be to restore the complete filtering on tabchange, wouldn't it?

ettavolt
27 Aug 2012, 5:38 AM
Best would be to restore the complete filtering on tabchange, wouldn't it?
According to the MVC concept it is better to have two models (in case of grid - Stores).
Looks like your grids are fed with remote data - so, I think, you should have two stores with some extra filter.

JulianB
27 Aug 2012, 5:42 AM
Yeah, that's what i thought. (It would be confusing to use the same store for different grids and show "different" data in them coming from the same store anyway.)