From: Nicolas Frey <n.frey@proxmox.com>
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 [thread overview]
Message-ID: <20261028151517.518742-3-n.frey@proxmox.com> (raw)
In-Reply-To: <20261028151517.518742-1-n.frey@proxmox.com>
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 <n.frey@proxmox.com>
---
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<S: DataStore> {
cursor: Option<Cursor>,
last_select_position: Option<usize>,
selection_status: RowSelectionStatus,
+ /// Whether all rows were explicitly selected, so that rows added later get selected too.
+ select_all_requested: bool,
_selection_observer: Option<SelectionObserver>,
@@ -770,9 +772,11 @@ impl<S: DataStore> PwtDataTable<S> {
}
selection.bulk_select(keys);
self.selection_status = RowSelectionStatus::All;
+ self.select_all_requested = true;
}
fn clear_selection(&mut self, props: &DataTable<S>) {
+ self.select_all_requested = false;
if let Some(selection) = &props.selection {
selection.clear();
}
@@ -1200,6 +1204,7 @@ impl<S: DataStore + 'static> Component for PwtDataTable<S> {
cursor: None,
last_select_position: None,
selection_status: RowSelectionStatus::Nothing,
+ select_all_requested: false,
_selection_observer,
active_column: 0,
@@ -1245,6 +1250,9 @@ impl<S: DataStore + 'static> Component for PwtDataTable<S> {
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<S: DataStore + 'static> Component for PwtDataTable<S> {
}
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
next prev parent reply other threads:[~2026-10-28 15:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 15:15 [PATCH proxmox-yew-widget-toolkit 0/5] add multi-select component Nicolas Frey
2026-10-28 15:15 ` [PATCH proxmox-yew-widget-toolkit 1/5] widget: data table: simplify lookup of keys near the cursor Nicolas Frey
2026-10-28 15:15 ` Nicolas Frey [this message]
2026-10-28 15:15 ` [PATCH proxmox-yew-widget-toolkit 3/5] widget: grid picker: keep selected records hidden by the filter Nicolas Frey
2026-10-28 15:15 ` [PATCH proxmox-yew-widget-toolkit 4/5] widget: form: implement multi select field Nicolas Frey
2026-10-28 15:15 ` [PATCH proxmox-yew-widget-toolkit 5/5] widget: form: combobox: update doc to point to `MultiSelect` Nicolas Frey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261028151517.518742-3-n.frey@proxmox.com \
--to=n.frey@proxmox.com \
--cc=yew-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox