From: Dominik Csapak <d.csapak@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [PATCH yew-widget-toolkit 3/5] widget: data table: update cell configuration on property change
Date: Fri, 16 Oct 2026 11:01:12 +0200 [thread overview]
Message-ID: <20261016090256.1170172-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20261016090256.1170172-1-d.csapak@proxmox.com>
The cell configuration was only used when the table was created, so
changing it later (e.g. adding a class) had no effect on the cells.
Fix this by setting it again when the property changes.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/widget/data_table/data_table.rs | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/widget/data_table/data_table.rs b/src/widget/data_table/data_table.rs
index 6a30dc2..1fb09d6 100644
--- a/src/widget/data_table/data_table.rs
+++ b/src/widget/data_table/data_table.rs
@@ -583,6 +583,15 @@ fn render_empty_row_with_sizes(widths: &[f64], column_hidden: &[bool], bordered:
.into()
}
+// Cells get the default class, unless the configuration sets its own.
+fn cell_config(config: &CellConfiguration) -> Rc<CellConfiguration> {
+ Rc::new(if config.class.is_empty() {
+ CellConfiguration::new().class("pwt-datatable-cell")
+ } else {
+ config.clone()
+ })
+}
+
impl<S: DataStore> PwtDataTable<S> {
// avoid slow search by lookup up keys nearby cursor first
fn filtered_record_pos(&self, props: &DataTable<S>, key: &Key) -> Option<usize> {
@@ -1091,12 +1100,6 @@ impl<S: DataStore + 'static> Component for PwtDataTable<S> {
fn create(ctx: &Context<Self>) -> Self {
let props = ctx.props();
- let cell_config = if props.cell_configuration.class.is_empty() {
- CellConfiguration::new().class("pwt-datatable-cell")
- } else {
- props.cell_configuration.clone()
- };
-
let _store_observer = props
.store
.add_listener(ctx.link().callback(|_| Msg::DataChange));
@@ -1123,7 +1126,7 @@ impl<S: DataStore + 'static> Component for PwtDataTable<S> {
column_widths: Vec::new(),
column_hidden: Rc::new(Vec::new()),
scroll_info: VirtualScrollInfo::default(),
- cell_config: Rc::new(cell_config),
+ cell_config: cell_config(&props.cell_configuration),
scroll_top: 0,
set_scroll_top: None,
viewport_height: 0.0,
@@ -1830,6 +1833,10 @@ impl<S: DataStore + 'static> Component for PwtDataTable<S> {
self.init_headers(props);
}
+ if props.cell_configuration != old_props.cell_configuration {
+ self.cell_config = cell_config(&props.cell_configuration);
+ }
+
true
}
--
2.47.3
next prev parent reply other threads:[~2026-10-16 9:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 9:01 [PATCH yew-widget-toolkit 0/5] data table fixes Dominik Csapak
2026-10-16 9:01 ` [PATCH yew-widget-toolkit 1/5] widget: data table: keep hidden columns when headers are recreated Dominik Csapak
2026-10-16 9:01 ` [PATCH yew-widget-toolkit 2/5] widget: data table: update listeners when store or selection change Dominik Csapak
2026-10-16 9:01 ` Dominik Csapak [this message]
2026-10-16 9:01 ` [PATCH yew-widget-toolkit 4/5] widget: data table: header: fix keyboard navigation from group headers Dominik Csapak
2026-10-16 9:01 ` [PATCH yew-widget-toolkit 5/5] widget: data table: header: skip hidden cells in keyboard navigation Dominik Csapak
2026-10-16 9:44 ` applied: [PATCH yew-widget-toolkit 0/5] data table fixes Dietmar Maurer
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=20261016090256.1170172-4-d.csapak@proxmox.com \
--to=d.csapak@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