PDA

View Full Version : ComboBox default selected value



sencha_cool
23 Aug 2012, 9:24 PM
Hi folks,

I have ComboBox with list of fruits

Example : "ALL" ,"Mangoes", "Apple", "Bananas"...

upon selecting any one option like mangoes i am displaying the selected fruit name and other information related to fruit in a grid panel

by using fruitCaloriesStore.filterBy(function(record){
var fruitType = record.get('fruitType');
if(fruitType == combo.getValue())
{
return true ;
}
});


but if iam selecting default value "ALL"

i need to reload the grid panel with fruitStore(with all fruits)

tried fruitCaloriesStore.reload it did not worked how to accomplish this..

Thanks in Advance...

sword-it
23 Aug 2012, 10:58 PM
Hi,

you can use following code:




fruitCaloriesStore.filterBy(function(record){
if( combo.getValue()=='ALL')
{
return true ;
}
});



After filter the store You have to refresh the gridview , for this you can see this link
http://docs.sencha.com/ext-js/3-4/#!/api/Ext.grid.GridView-method-refresh

sencha_cool
24 Aug 2012, 5:27 AM
Sword tried yout solution it worked fine thx :)