-
17 Mar 2013 4:27 PM #1
Updating a record in grouped store, trigger remove action on the store's proxy
Updating a record in grouped store, trigger remove action on the store's proxy
In Ext JS version 4.0.2.663, updating the group field of a record in grouped store, cause that record to be remove then reinserted. Unfortunately, the remove is not silent therefore it trigger the remove action on the store's proxy.
Offending code is located at updateGroupsOnUpdate function, src/data/Store.js (line 1142).
-
18 Mar 2013 10:15 AM #2
Thanks for the report! I have opened a bug in our bug tracker.
-
18 Mar 2013 10:36 AM #3
Sorry about that. The overrides are:
Code:Ext.override(Ext.data.Group, { contains: function(record){ return Ext.Array.indexOf(this.records, record) !== -1; } });Code:Ext.override(Ext.data.Store, { updateGroupsOnUpdate: function(record, modifiedFieldNames){ var me = this, groupField = me.getGroupField(), groupName = me.getGroupString(record), groups = me.groups, len, i, items, group; if (modifiedFieldNames && Ext.Array.indexOf(modifiedFieldNames, groupField) !== -1) { // First find the old group and remove the record items = groups.items; for (i = 0, len = items.length; i < len; ++i) { group = items[i]; if (group.contains(record)) { group.remove(record); break; } } groups.getByKey(groupName); if (!group) { group = groups.add(new Ext.data.Group({ key: groupName, store: me })); } group.add(record); // At this point we know that we're sorted, so re-insert the record me.suspendEvents(); me.remove(record, true); me.addSorted(record); me.resumeEvents(); } else { // some other field changed, just mark the group as dirty groups.getByKey(groupName).setDirty(); } } });Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-9176
in
4.2.1.


Reply With Quote