Actual code
setStore : function(store, initial){
if(!initial && this.store){
this.store.un("datachanged", this.refresh);
this.store.un("add", this.onAdd);
this.store.un("remove", this.onRemove);
this.store.un("update", this.onUpdate);
this.store.un("clear", this.refresh);
}
if(store){
store.on("datachanged", this.refresh, this);
store.on("add", this.onAdd, this);
store.on("remove", this.onRemove, this);
store.on("update", this.onUpdate, this);
store.on("clear", this.refresh, this);
}
this.store = store;
if(store){
this.refresh();
}
}
Should be:
setStore : function(store, initial){
if(!initial && this.store){
this.store.un("datachanged", this.refresh, this);
this.store.un("add", this.onAdd, this);
this.store.un("remove", this.onRemove, this);
this.store.un("update", this.onUpdate, this);
this.store.un("clear", this.refresh, this);
}
if(store){
store.on("datachanged", this.refresh, this);
store.on("add", this.onAdd, this);
store.on("remove", this.onRemove, this);
store.on("update", this.onUpdate, this);
store.on("clear", this.refresh, this);
}
this.store = store;
if(store){
this.refresh();
}
}
Without this in un() method calls the view doesn't unbinds from old store's events.
Fixed in SVN. Thanks.
Yes, I'm notifying Jack on this.
Allergies.. no relief?!?
Religion in the workplace? |