jbraband
04-27-2007, 02:28 PM
The constructor of Ext.PagingToolbar stores the passed datastore in a member variable (this.ds). this member variable is used in a couple different places throughout the class (updateInfo(), getPageData(), onPagingKeydown(), onClick()).
the methods bind () and unbind(), although being passed a new reference to a different datastore which will control the data used to configure the paging toolbar, is not resetting the value of the datastore member variable (this.ds). because of this, the paging toolbar will always be referencing the original datastore passed at construction-time.
the fix is simple.
/**
* Unbinds the paging toolbar from the specified {@link Ext.data.Store}
* @param {Ext.data.Store} store The data store to unbind
*/
unbind : function(ds){
ds.un("beforeload", this.beforeLoad, this);
ds.un("load", this.onLoad, this);
ds.un("loadexception", this.onLoadError, this);
this.ds = undefined;
},
/**
* Binds the paging toolbar to the specified {@link Ext.data.Store}
* @param {Ext.data.Store} store The data store to bind
*/
bind : function(ds){
ds.on("beforeload", this.beforeLoad, this);
ds.on("load", this.onLoad, this);
ds.on("loadexception", this.onLoadError, this);
this.ds = ds;
}
i have a file called ExtMods.js that looks like this (it handles all of my Ext overrides and modifications so that I am not modify the distributed Ext source).
Ext.PagingToolbar.prototype.unbind = function(ds){
ds.un("beforeload", this.beforeLoad, this);
ds.un("load", this.onLoad, this);
ds.un("loadexception", this.onLoadError, this);
this.ds = undefined;
};
Ext.PagingToolbar.prototype.bind = function(ds){
ds.on("beforeload", this.beforeLoad, this);
ds.on("load", this.onLoad, this);
ds.on("loadexception", this.onLoadError, this);
this.ds = ds;
}
of course once this makes its way into the distributed source, i will remove it from ExtMods.js and be back to using 100% distributed source.
-j
the methods bind () and unbind(), although being passed a new reference to a different datastore which will control the data used to configure the paging toolbar, is not resetting the value of the datastore member variable (this.ds). because of this, the paging toolbar will always be referencing the original datastore passed at construction-time.
the fix is simple.
/**
* Unbinds the paging toolbar from the specified {@link Ext.data.Store}
* @param {Ext.data.Store} store The data store to unbind
*/
unbind : function(ds){
ds.un("beforeload", this.beforeLoad, this);
ds.un("load", this.onLoad, this);
ds.un("loadexception", this.onLoadError, this);
this.ds = undefined;
},
/**
* Binds the paging toolbar to the specified {@link Ext.data.Store}
* @param {Ext.data.Store} store The data store to bind
*/
bind : function(ds){
ds.on("beforeload", this.beforeLoad, this);
ds.on("load", this.onLoad, this);
ds.on("loadexception", this.onLoadError, this);
this.ds = ds;
}
i have a file called ExtMods.js that looks like this (it handles all of my Ext overrides and modifications so that I am not modify the distributed Ext source).
Ext.PagingToolbar.prototype.unbind = function(ds){
ds.un("beforeload", this.beforeLoad, this);
ds.un("load", this.onLoad, this);
ds.un("loadexception", this.onLoadError, this);
this.ds = undefined;
};
Ext.PagingToolbar.prototype.bind = function(ds){
ds.on("beforeload", this.beforeLoad, this);
ds.on("load", this.onLoad, this);
ds.on("loadexception", this.onLoadError, this);
this.ds = ds;
}
of course once this makes its way into the distributed source, i will remove it from ExtMods.js and be back to using 100% distributed source.
-j