From: Shannon Sterz <s.sterz@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [PATCH yew-widget-toolkit 1/1] gridpicker/combobox: allow autoselecting the filter field
Date: Thu, 5 Mar 2026 12:21:58 +0100 [thread overview]
Message-ID: <20260305112158.220557-5-s.sterz@proxmox.com> (raw)
In-Reply-To: <20260305112158.220557-1-s.sterz@proxmox.com>
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/widget/form/combobox.rs | 8 ++++++++
src/widget/grid_picker.rs | 6 ++++++
2 files changed, 14 insertions(+)
diff --git a/src/widget/form/combobox.rs b/src/widget/form/combobox.rs
index db4505f6..efc2365f 100644
--- a/src/widget/form/combobox.rs
+++ b/src/widget/form/combobox.rs
@@ -99,6 +99,11 @@ pub struct Combobox {
#[prop_or_default]
#[builder]
pub trigger: Vec<(Trigger, bool)>,
+
+ /// Whether the filter should be auto-selected when the picker is displayed.
+ #[builder(IntoPropValue, into_prop_value)]
+ #[prop_or_default]
+ pub autoselect_filter: Option<bool>,
}
impl Default for Combobox {
@@ -295,6 +300,8 @@ impl Component for PwtCombobox {
.show_filter
.unwrap_or_else(|| self.store.data_len() > 10);
+ let auto_select_filter = ctx.props().autoselect_filter;
+
let filter = props.filter.clone();
let columns = Rc::clone(&self.columns);
@@ -311,6 +318,7 @@ impl Component for PwtCombobox {
.selection(args.selection.clone())
.show_filter(show_filter)
.filter(filter.clone())
+ .autoselect_filter(auto_select_filter)
.on_select(args.controller.on_select_callback());
if show_filter {
diff --git a/src/widget/grid_picker.rs b/src/widget/grid_picker.rs
index 5e8d44d0..304e54a2 100644
--- a/src/widget/grid_picker.rs
+++ b/src/widget/grid_picker.rs
@@ -74,6 +74,11 @@ pub struct GridPicker<S: DataStore> {
#[builder_cb(IntoTextFilterFn, into_text_filter_fn, S::Record)]
#[prop_or_default]
pub filter: Option<TextFilterFn<S::Record>>,
+
+ /// Whether the filter should be auto-selected when the picker is displayed.
+ #[builder(IntoPropValue, into_prop_value)]
+ #[prop_or_default]
+ pub autoselect_filter: Option<bool>,
}
impl<S: DataStore> GridPicker<S> {
@@ -196,6 +201,7 @@ impl<S: DataStore + 'static> Component for PwtGridPicker<S> {
.with_child(html! {<label for="testinput">{"Filter"}</label>})
.with_child(
Input::new()
+ .autofocus(ctx.props().autoselect_filter.unwrap_or_default())
.attribute("autocomplete", "off")
.attribute("size", "1") // make size minimal
.class("pwt-input")
--
2.47.3
next prev parent reply other threads:[~2026-03-05 11:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 11:21 [PATCH yew-widget-toolkit/yew-widget-toolkit-assets 0/4] yew ui tweaks Shannon Sterz
2026-03-05 11:21 ` [PATCH yew-widget-toolkit-assets 1/3] dialog: allow resize handle to fill the padding space in dialogs Shannon Sterz
2026-03-05 11:21 ` [PATCH yew-widget-toolkit-assets 2/3] tree-wide: replace the disabled opacity with a variable and decrease it Shannon Sterz
2026-03-05 11:21 ` [PATCH yew-widget-toolkit-assets 3/3] docs: run `make refresh` Shannon Sterz
2026-03-05 11:21 ` Shannon Sterz [this message]
2026-03-05 12:54 ` applied: [PATCH yew-widget-toolkit/yew-widget-toolkit-assets 0/4] yew ui tweaks Dominik Csapak
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=20260305112158.220557-5-s.sterz@proxmox.com \
--to=s.sterz@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