From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id CFAD71FF0E5 for ; Wed, 28 Oct 2026 16:15:22 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 614082140D; Wed, 28 Oct 2026 16:15:22 +0100 (CET) From: Nicolas Frey To: yew-devel@lists.proxmox.com Subject: [PATCH proxmox-yew-widget-toolkit 2/5] widget: data table: only extend explicit select all to new rows Date: Wed, 28 Oct 2026 16:15:12 +0100 Message-ID: <20261028151517.518742-3-n.frey@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261028151517.518742-1-n.frey@proxmox.com> References: <20261028151517.518742-1-n.frey@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793200517394 X-SPAM-LEVEL: Spam detection results: 0 AWL 1.306 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 2UTUTBLOVFCXMXQRCZBORCMCOYFTGBOD X-Message-ID-Hash: 2UTUTBLOVFCXMXQRCZBORCMCOYFTGBOD X-MailFrom: n.frey@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Yew framework devel list at Proxmox List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: the "all" status was also set when every visible row happened to be selected, so clearing a filter after selecting all matching rows selected the whole table. remember whether select all was explicitly requested via the header, and only then extend the selection on data changes. Signed-off-by: Nicolas Frey --- src/widget/data_table/data_table.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/widget/data_table/data_table.rs b/src/widget/data_table/data_table.rs index e846522..90f37ea 100644 --- a/src/widget/data_table/data_table.rs +++ b/src/widget/data_table/data_table.rs @@ -518,6 +518,8 @@ pub struct PwtDataTable { cursor: Option, last_select_position: Option, selection_status: RowSelectionStatus, + /// Whether all rows were explicitly selected, so that rows added later get selected too. + select_all_requested: bool, _selection_observer: Option, @@ -770,9 +772,11 @@ impl PwtDataTable { } selection.bulk_select(keys); self.selection_status = RowSelectionStatus::All; + self.select_all_requested = true; } fn clear_selection(&mut self, props: &DataTable) { + self.select_all_requested = false; if let Some(selection) = &props.selection { selection.clear(); } @@ -1200,6 +1204,7 @@ impl Component for PwtDataTable { cursor: None, last_select_position: None, selection_status: RowSelectionStatus::Nothing, + select_all_requested: false, _selection_observer, active_column: 0, @@ -1245,6 +1250,9 @@ impl Component for PwtDataTable { match msg { Msg::SelectionChange => { self.update_selection_status(props); + if self.selection_status != RowSelectionStatus::All { + self.select_all_requested = false; + } true } Msg::DataChange => { @@ -1259,7 +1267,10 @@ impl Component for PwtDataTable { } self.update_scroll_info(props); - if self.selection_status == RowSelectionStatus::All { + // only an explicit select all extends to new rows. deriving it from the selection + // status would select every row once a filter is removed, if all rows that + // matched the filter happened to be selected. + if self.select_all_requested { self.select_all(props); } else { self.cleanup_selection(props); -- 2.47.3