版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/inforstack/article/details/53608732
var myStore = Ext.create('Ext.data.Store', {
fields: [
{name: 'firstName', type: 'string'},
{name: 'lastName', type: 'string'},
{name: 'age', type: 'int'},
{name: 'eyeColor', type: 'string'}
],
data : [
{firstName: 'Peter', lastName: 'Venkman'},
{firstName: 'Egon', lastName: 'Spengler'},
{firstName: 'Ray', lastName: 'Stantz'},
{firstName: 'Winston', lastName: 'Zeddemore'}
]
});
//如果不清空,将在上次过滤的基础上再次过滤
myStore.clearFilter();
//filter with a single field
myStore.filter('firstName', 'Don');
//filtering with multiple filters
myStore.filter([{
property : 'firstName',
value : 'Don'
},{
property : 'lastName',
direction: 'Griffin'
}]);
//自定义过滤
myStore.filterBy(function(record){
return record.get('firstName') == 'Don';
})