Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to filter a store with multiple values at once?

I have a Store attached to a grid with number of records. I have a combo box with mulitiSelect option. So whenever i select multiple values in the Combo box. the grid must be filtered with all the criteria provided. I can get the values from the combo box as comma separated values but unable to send them to store's filter config.

Please Help!

Thanks!

like image 204
Anand Singh Avatar asked Dec 11 '22 13:12

Anand Singh


1 Answers

A bit cleaner:

var store = grid.getStore();
var selectedItems = csvList.split(","); //your list of comma separated values
store.clearFilter();
store.filterBy(function(record, id){
    return Ext.Array.indexOf(selectedItems, record.get("value")) !== -1;
}, this);
like image 198
Mike Avatar answered Dec 24 '22 07:12

Mike