PDA

View Full Version : applying filtered store to grid



raj_plays
27 Jul 2011, 10:32 PM
Hi,
I have 2 grids on my page. Both have the same structure, so I want to apply the same store to both.
The store has a name field. Grid1 should show all 'A' names and grid2 should show all 'B' names
I was trying to do a store.filter('name','A'); and apply it to gr1d1,
then store.clearFilter(); store.filter('name','B'); and apply to grid2
but the 2 grids show blank.
Please help.



var SkinDataStore = new Ext.data.XmlStore({
url: 'CampaignService.asmx/getMobileCampaignImages',
baseParams: {campaign_id: campaign_id, banner_type: 1},
record: 'Table',
idPath: 'id',
fields: [{name: 'image', type: 'string'}, {name: 'page_id', type: 'int'}],
autoLoad: true,
listeners: {
load: function(st, records, options){
showGrids();
}
}
});

function showGrids()
{
SkinDataStore.filter('page_id', '3');

var Grid1 = new Ext.grid.GridPanel({
id: 'Grid1',
title: 'Splash Skin Images',
store: SkinDataStore
.....
}

SkinDataStore.clearFilter();
SkinDataStore.filter('page_id', '1');


var Grid2 = new Ext.grid.GridPanel({
id: 'Grid2',
title: 'Now Playing Skin Images',
store: SkinDataStore
......
}