From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 512A71FF0B7 for ; Fri, 16 Oct 2026 11:03:00 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 07B1B214CA; Fri, 16 Oct 2026 11:03:00 +0200 (CEST) From: Dominik Csapak 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 Message-ID: <20261016090256.1170172-4-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261016090256.1170172-1-d.csapak@proxmox.com> References: <20261016090256.1170172-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.360 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: 5JQ7VKY25HFBXXBZIGAXY7FBGS5QWLJM X-Message-ID-Hash: 5JQ7VKY25HFBXXBZIGAXY7FBGS5QWLJM X-MailFrom: d.csapak@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 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 --- 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 { + Rc::new(if config.class.is_empty() { + CellConfiguration::new().class("pwt-datatable-cell") + } else { + config.clone() + }) +} + impl PwtDataTable { // avoid slow search by lookup up keys nearby cursor first fn filtered_record_pos(&self, props: &DataTable, key: &Key) -> Option { @@ -1091,12 +1100,6 @@ impl Component for PwtDataTable { fn create(ctx: &Context) -> 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 Component for PwtDataTable { 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 Component for PwtDataTable { self.init_headers(props); } + if props.cell_configuration != old_props.cell_configuration { + self.cell_config = cell_config(&props.cell_configuration); + } + true } -- 2.47.3