View Full Version : [OPEN-1270] Store#reMap doesn't respect filtered stores

20 Sep 2010, 4:29 AM
I've encountered a problem with filtered stores and the Store#reMap method which is called after a new record is inserted into a store and saved.

The problem is it doesn't respect filtered stores, which leads to a nonfunctional Store#getById method:

getById : function(id){
return (this.snapshot || this.data).key(id);

As you can see, the method takes in account this.snapshot, but after saving a new record, this is how the this.snapshot.keys referece looks like:

[48, 49, "ext-record-6"]

Compared to this.data.keys:

[48, 49, 50]

Also, when you clear filters with #clearFilter, the data property is replaced by the incorrect snapshot collection.

I've only found one mention of this bug on the forums but with no official answer:

I've also found several other discussions on problems with Store#reMap and DataReader#realize but with no mention of this issue:

21 Sep 2010, 2:57 AM
In case someone else needs a quick & dirty fix:

Ext.override(Ext.data.Store, {
reMap: function(record) {
if (Ext.isArray(record)) {
for (var i = 0, len = record.length; i < len; i++) {
} else {
function alterHashMap(data, record) {
delete data.map[record._phid];
data.map[record.id] = record;
var index = data.keys.indexOf(record._phid);
data.keys.splice(index, 1, record.id);
alterHashMap(this.data, record);
if (this.snapshot) {
alterHashMap(this.snapshot, record);
delete record._phid;

22 Jul 2013, 5:49 PM
Thanks so much feiichi. I just ran into this issue today.

Sencha people. Has this been fixed in later versions of ExtJs (I'm using 3.4.0).