From 4b070b28a314d48289cffa0bc53917d04a5f1f4d Mon Sep 17 00:00:00 2001 From: Argo Date: Tue, 30 Sep 2025 11:02:37 +0800 Subject: [PATCH 1/2] fix(Table): double click col trigger ResizeColumnCallback --- .../Components/Table/Table.razor.js | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/BootstrapBlazor/Components/Table/Table.razor.js b/src/BootstrapBlazor/Components/Table/Table.razor.js index 4666976cc87..2f3cbd3f206 100644 --- a/src/BootstrapBlazor/Components/Table/Table.razor.js +++ b/src/BootstrapBlazor/Components/Table/Table.razor.js @@ -617,16 +617,7 @@ const setResizeListener = table => { } tableEl.setAttribute('style', `width: ${width}px;`) - if (table.options.showColumnWidthTooltip) { - const tip = bootstrap.Tooltip.getInstance(col); - if (tip && tip._isShown()) { - const inner = tip.tip.querySelector('.tooltip-inner'); - const tipText = getColumnTooltipTitle(table.options, colWidth + marginX); - inner.innerHTML = tipText; - tip._config.title = tipText; - tip.update(); - } - } + resetColumnWidthTips(table, col); const header = col.parentElement; if (header.classList.contains('fixed')) { @@ -680,13 +671,26 @@ const resizeNextFixedColumnWidth = (col, width) => { } } +const resetColumnWidthTips = (table, col) => { + if (table.options.showColumnWidthTooltip) { + const tip = bootstrap.Tooltip.getInstance(col); + if (tip && tip._isShown()) { + const inner = tip.tip.querySelector('.tooltip-inner'); + const tipText = getColumnTooltipTitle(table.options, col.closest('th')); + inner.innerHTML = tipText; + tip._config.title = tipText; + tip.update(); + } + } +} + const setColumnResizingListen = (table, col) => { if (table.options.showColumnWidthTooltip) { EventHandler.on(col, 'mouseenter', e => { closeAllTips(table.columns, e.target); const th = col.closest('th'); const tip = bootstrap.Tooltip.getOrCreateInstance(e.target, { - title: getColumnTooltipTitle(table.options, th.offsetWidth), + title: getColumnTooltipTitle(table.options, th), trigger: 'manual', placement: 'top', customClass: 'table-resizer-tips' @@ -698,8 +702,8 @@ const setColumnResizingListen = (table, col) => { } } -const getColumnTooltipTitle = (options, width) => { - return `${options.columnWidthTooltipPrefix}${width}px`; +const getColumnTooltipTitle = (options, th) => { + return `${options.columnWidthTooltipPrefix}${th.offsetWidth}px`; } const indexOfCol = col => { @@ -742,6 +746,12 @@ const autoFitColumnWidth = async (table, col) => { }); setTableDefaultWidth(table); + + if (table.options.resizeColumnCallback) { + await table.invoke.invokeMethodAsync(table.options.resizeColumnCallback, index, maxWidth) + } + + resetColumnWidthTips(table, col); } } From 775aa86f5914e516ee0d1d15ab855d4e7fd6a572 Mon Sep 17 00:00:00 2001 From: Argo Date: Tue, 30 Sep 2025 08:20:01 +0800 Subject: [PATCH 2/2] chore: bump version 9.11.1-beta01 --- src/BootstrapBlazor/BootstrapBlazor.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index 67b9052d55b..4416abf0822 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@  - 9.11.0 + 9.11.1-beta01