Skip to content

Commit b56e72e

Browse files
committed
Fix column width calculation to use header cell
Updated autoFitColumnWidth to calculate the header cell width using the <th> element directly instead of querying for a child span. This ensures more accurate column width fitting when including the header.
1 parent 96cc874 commit b56e72e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/BootstrapBlazor/Components/Table/Table.razor.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,7 @@ const autoFitColumnWidth = async (table, col) => {
744744

745745
if (table.options.fitColumnWidthIncludeHeader) {
746746
const th = col.closest('th');
747-
const span = th.querySelector('.table-cell');
748-
maxWidth = Math.max(maxWidth, calcCellWidth(span));
747+
maxWidth = Math.max(maxWidth, calcCellWidth(th));
749748
}
750749

751750
if (table.options.autoFitColumnWidthCallback !== null) {

0 commit comments

Comments
 (0)