Aminesrine
Aminesrine

Reputation: 2140

Extjs, filtering grid dynamically

I'm developping with extjs4.
I have two grids as shown in the image, I want when I click on the line of Grid Panel 1 that contanis Number 1, the Grid Panel 2 will show only lines that contains Number 1.

enter image description here

Upvotes: 1

Views: 3926

Answers (1)

sra
sra

Reputation: 23973

That is pretty much straightforward; subscribe to the select event of the first grid and within that handler filter the store of the second grid. That's it.

grid1.on('select', function(grid,record) { 
   grid2.store.clearFilter(true); // see http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Store-method-clearFilter
   grid2.store.filter('Number', record.get('Number');
},this);

Upvotes: 2

Related Questions