PDA

View Full Version : working with buffered store



Ex_Soft
13 Jun 2012, 1:09 AM
I'm working with huge data. So I use buffered (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.data.Store-cfg-buffered) store. However almost all functions of store (getById() (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.data.Store-method-getById)/find() (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.data.Store-method-find)/filter() (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.data.Store-method-filter)/etc.) work with data (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.data.Store-property-data) but not with prefetchData and they don't work. How to solve this issue?

scottmartin
13 Jun 2012, 12:38 PM
Use paging instead of buffered store.

Scott.

Ex_Soft
16 Aug 2012, 12:03 AM
Use paging instead of buffered store.

I've tried to use Ext.ux.data.PagingMemoryProxy. filter() (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store-method-filter)/sort() (http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store-method-sort) work. But




...
getById: function(id) {
return (this.snapshot || this.data).findBy(function(record) {
return record.getId() === id;
});
},
...


and




...

find: function(property, value, start, anyMatch, caseSensitive, exactMatch) {
var fn = this.createFilterFn(property, value, anyMatch, caseSensitive, exactMatch);
return fn ? this.data.findIndexBy(fn, null, start) : -1;
}, ...


work with only current page. Is there any way to solve this issue?

apovodyrev
11 Jul 2013, 1:49 PM
Something like this may work instead of store.getById(). Just experimenting but seem working for me.
getOrderById:function(id){
var record = this.getById(id);
if(!record && this.pageMap){ //try buffer
for (var page in this.pageMap.map) {
var data = this.pageMap.map[page].value;
for (var i=0; i<data.length; i++){
if(data[i].getId() === id)
return data[i];
}
}
}
return record;
}