Oct 30, 2014, 4:30 PM
Store filter strange behavior
Hello
I'm not sure if this is a bug or my stupidity - maybe there is something I oversee
note that another strange thing is if I bind store2 to editable combobox filter disappear as long as user type somethign in combobox, while with store1, filter is still there regardeless what user type in
Please let me know it this is a bug of feature
Z
I'm not sure if this is a bug or my stupidity - maybe there is something I oversee
function test() {
var data = [
{ Id: 1, Name: 'Name1' }, { Id: 2, Name: 'Name2' }
];
Ext.define('Model1', {
extend: 'Ext.data.Model',
fields:['Id','Name'],
idProperty: 'Id'
});
var store = new Ext.data.Store({
proxy: { type: 'memory' },
model:'Model1',
data:data,
filters: [
function (item) {
return item.get('Id') == 1;
}
]
});
console.info(store.getCount());
store.clearFilter();
console.info(store.getCount()); // I would expect 2 here? - returned 1 - looks like store is still fitlered?
console.info(store.query('Name', 'Name1').getCount());
console.info(store.query('Name', 'Name2').getCount()); // I would expect 1 here, returned 0
var store2 = new Ext.data.Store({
proxy: { type: 'memory' },
model: 'Model1',
data: data
});
store2.filterBy(function (item) {
return item.get('Id') == 1;
});
console.info(store2.getCount());
store2.clearFilter();
console.info(store2.getCount()); // correctly returns 2
}
Ext.onReady(test);
tested on ExtJS 4.2.1.883 (Ext.net 2.5.0.30649)note that another strange thing is if I bind store2 to editable combobox filter disappear as long as user type somethign in combobox, while with store1, filter is still there regardeless what user type in
Please let me know it this is a bug of feature
Z