From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id A982B82D35 for ; Wed, 1 Dec 2021 11:57:09 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A7868B350 for ; Wed, 1 Dec 2021 11:57:09 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id E65A1B33D for ; Wed, 1 Dec 2021 11:57:08 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id AACE544CCB for ; Wed, 1 Dec 2021 11:57:08 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Wed, 1 Dec 2021 11:57:08 +0100 Message-Id: <20211201105708.3150068-3-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211201105708.3150068-1-d.csapak@proxmox.com> References: <20211201105708.3150068-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.181 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 3/3] ui: form/GroupFilter: copy records for the pbsGroupSelectors X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Dec 2021 10:57:09 -0000 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 --- 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 -- 2.30.2