PDA

View Full Version : Store filter problem



NexusOne
16 Jan 2013, 8:34 AM
When I call store.filter() first, it create snapshot
me.snapshot = me.snapshot || me.data.clone();


Then I change some record. And try to filter again, but store use old snapshot data

mitchellsimoens
18 Jan 2013, 4:51 AM
Should work as expected:


var store = new Ext.data.Store({
fields : ['foo', 'filter', 'changeMe'],
data : [
{ foo : 'One', filter : 1, changeMe : 'blam' },
{ foo : 'Two', filter : 2, changeMe : 'blam' }
]
});

store.filter('filter', 1);

console.log(store.first().data); //changeMe = 'blam'

store.first().set('changeMe', 'woot');

store.clearFilter();
store.filter('filter', 2);

console.log(store.first().data); //changeMe = 'blam'

store.clearFilter();
store.filter('filter', 1);

console.log(store.first().data); //changeMe = 'woot'