PDA

View Full Version : grouping in multiple grids pointing to the same store in Architect project



oussama.khalfaoui
13 May 2014, 7:27 AM
Hi,
I have multiple instances of the same grid so they still point to the same store, which creates an issue.. I want to use the grouping feature differently on each grid! For example, the user can group by field1 on first grid and group by field 2 on grid 2 etc. However, when i group by one field on a grid, all others do the same! Any help please!

jsakalos
13 May 2014, 10:57 PM
I've found one way, however it's tricky/hacky.

First, you need to override initComponent of the grid by promoting it to class and then creating override. In the override you create the store manually.

I haven't found a way to remove the store from Application:: stores[] without removing it from the project so you would always wind up with one extra store created by the framework automatically. # of stores = # of grid instances + 1

oussama.khalfaoui
14 May 2014, 3:04 AM
hi jsakalos (http://www.sencha.com/forum/member.php?2178-jsakalos) , thx for your reply :) In fact, I have found a way to do that by creating an instance of store that share the same data each time I open a new grid and it works fine

var blotterstore= Ext.getStore('BlotterStore');
var data= blotterstore.data.items;
var store= Ext.create('MyApp.store.BlotterStore');
store.add(data);
newBlotter.down('#blotter').down('#gridPanel').reconfigure(store);

jsakalos
14 May 2014, 4:08 AM
Yeah, also the way, hackish too. I'd prefer if Architect would have a built-in way how to do that. Anyway, congrats!