PDA

View Full Version : Grid plug-in for event's store interceptor



seek
4 Oct 2011, 1:07 AM
Hi all,
I'm trying to build a plugin for grid component, where store.findExact can scroll automatically across pages in order to get the correct record (if found).
My problem is to understand how to intercept and sobstitute the respective function in the store.


Ext.ux.autoloadOnFindExact = Ext.extend(Ext.util.Observable, {
init: function(grid){
grid.store.un('findExact', grid.store.findExact);
grid.store.on('findExact', this.findAcross);
},
findAcross: function(fieldName, value, startIndex){
var ds = this.store;
ds.suspendEvents();
ds.load({
params: {start: 0, limit: ds.getTotalCount() },
callback: function(){
var ret = ds.findExact(fieldName, value, startIndex);
ds.resumeEvents();
this.onViewRefresh();
//store.getAt at the correct page
return ret;
},
scope: this
});
}
});


Thanks all
S.

seek
6 Oct 2011, 3:47 AM
UP!