From f49cd6c1354211d83139b2eb0c3cf1b731f1ec8d Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Wed, 1 Dec 2021 11:57:08 +0100 Subject: [PATCH] ui: form/GroupFilter: copy records for the pbsGroupSelectors store.getData() returns an 'Ext.util.Collection' which is a special class that does more than being an array of records. Namely, it can have 'observers' which can react on the change of the collection Here, the 'onWidgetAttach' callback will be called twice on the first row add and the widgets (and thus stores) are cached by extjs. When doing a 'setData' of a Collection, it tries to add the store as an observer, but due to the above caching and multiple calling this fails since the store is already an observer. For this reason, we want to actually copy the records (which neither the store, nor the Collection has a method for...) This gives us an additional benefit: The different pbsGroupSelectors can sort independently now, before it was all linked to the original store's collection. Signed-off-by: Dominik Csapak Signed-off-by: Thomas Lamprecht --- www/form/GroupFilter.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/www/form/GroupFilter.js b/www/form/GroupFilter.js index 11aa24c4..7398d331 100644 --- a/www/form/GroupFilter.js +++ b/www/form/GroupFilter.js @@ -134,7 +134,11 @@ Ext.define('PBS.form.GroupFilter', { let regex = widget.down('textfield[type=regex]'); let group = widget.down('pbsGroupSelector'); - group.getStore().setData(view.dsStore.getData()); + let recs = []; + view.dsStore.each((record) => { + recs.push(record.data); + }); + group.getStore().setData(recs); // add a widget reference to the record so we can acces them // from the other column