From 5fb6697e2fddbb33cf1c170b5ab510adb593ddf7 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 24 Nov 2021 11:49:19 +0000 Subject: [PATCH] Fix Table THead Query Selector to target only first THead for FixedHeader and Resize features. (#3155) --- Source/Blazorise/wwwroot/table.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/Blazorise/wwwroot/table.js b/Source/Blazorise/wwwroot/table.js index ebfafd1338..e1133f9736 100644 --- a/Source/Blazorise/wwwroot/table.js +++ b/Source/Blazorise/wwwroot/table.js @@ -11,7 +11,8 @@ } function resizeHandler(element) { - const tableRows = element.querySelectorAll("thead tr"); + const thead = element.querySelector("thead:first-child"); + const tableRows = thead.querySelectorAll("tr"); if (tableRows !== null && tableRows.length > 1) { let previousRowCellHeight = 0; for (let i = 0; i < tableRows.length; i++) { @@ -31,7 +32,8 @@ export function destroyTableFixedHeader(element, elementId) { if (typeof this.resizeThottler === "function") { window.removeEventListener("resize", this.resizeThottler); } - const tableRows = element.querySelectorAll("thead tr"); + const thead = element.querySelector("thead:first-child"); + const tableRows = thead.querySelectorAll("tr"); if (tableRows !== null && tableRows.length > 1) { for (let i = 0; i < tableRows.length; i++) { @@ -68,7 +70,8 @@ export function initializeResizable(element, elementId, mode) { let cols = null; if (element !== null) { - cols = element.querySelectorAll('thead tr:first-child > th'); + const thead = element.querySelector("thead:first-child"); + cols = thead.querySelectorAll('tr:first-child > th'); } if (cols !== null) {