tbenbrahim
31 May 2007, 5:28 PM
There is a bug in SimpleStore when adding a single record using loadData with append=true
for example:
supplierStore.loadData([[data.id,data.name]],true);
I was expecting my combo box tied to supplierStore to update, but it did not. turns out that the add event is fired from MixedCollection, where events["add"]=true, rather than from the store scope, where events["add"] points back to the view onAdd handler.
The changed code is in the loadRecords method of SimpleStore, although this is not the only way to fix this.
}else{
this.totalLength = Math.max(t, this.data.length+r.length);
var index = this.data.length; //added
this.data.addAll(r); //fires add , but in scope of MixedCollection, not SimpleStore
this.fireEvent("add", this, r, index); //added
}
Tony BenBrahim
for example:
supplierStore.loadData([[data.id,data.name]],true);
I was expecting my combo box tied to supplierStore to update, but it did not. turns out that the add event is fired from MixedCollection, where events["add"]=true, rather than from the store scope, where events["add"] points back to the view onAdd handler.
The changed code is in the loadRecords method of SimpleStore, although this is not the only way to fix this.
}else{
this.totalLength = Math.max(t, this.data.length+r.length);
var index = this.data.length; //added
this.data.addAll(r); //fires add , but in scope of MixedCollection, not SimpleStore
this.fireEvent("add", this, r, index); //added
}
Tony BenBrahim