PDA

View Full Version : [CLOSED] [4.2.0] Ext.data.Store constructGroups function behaviour



HTK
26 Apr 2013, 12:12 AM
Hello,
we found out that in a grouping grid with a field of type integer as groupField, the
constructGroups function uses a Ext.util.AbstractMixedCollection get function which results in wrong grouping and throws an error:
"TypeError: groups.getByKey(...) is undefined". If i output the groups that are build I can see that the groups are generated wrong. This happens because the MixedCollection get function uses wheter the key OR the index. Using the index results in wrong group construction. I think the getByKey function of Ext.util.AbstractMixedCollection would solve this issue. I did an override an it works just fine.
The error happens after updating a record via rest proxy.



constructGroups: function() {
var me = this,
data = this.data.items,
len = data.length,
groups = me.groups,
groupValue, i, group, rec;

groups.clear();
for (i = 0; i < len; ++i) {
rec = data[i];
groupValue = me.getGroupString(rec);
//group = groups.get(groupValue); replaced with following:
group = groups.getByKey(groupValue);
if (!group) {
group = new Ext.data.Group({
key: groupValue,
store: me
});
groups.add(groupValue, group);
}
group.add(rec);
}
}

This is not really a bug, but I think the wrong function is used in this context.

slemmon
26 Apr 2013, 7:02 AM
Thanks for the report! I have opened the report in our tracker.