From 5f5c7adf7d054883c2cfcab515c4561bf835e78c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 19 Jun 2024 17:56:47 +0000 Subject: [PATCH] [Discover] Allow the last column of a table wider than the window to show up properly (#7058) Signed-off-by: Miki (cherry picked from commit 7aa61e42bf362156e9d2feaba1a4f5ec069dccaf) Signed-off-by: github-actions[bot] --- changelogs/fragments/7058.yml | 2 ++ .../default_discover_table/default_discover_table.tsx | 11 ++++------- 2 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 changelogs/fragments/7058.yml diff --git a/changelogs/fragments/7058.yml b/changelogs/fragments/7058.yml new file mode 100644 index 000000000000..ff86e5e65b8d --- /dev/null +++ b/changelogs/fragments/7058.yml @@ -0,0 +1,2 @@ +fix: +- [Discover] Allow the last column of a table wider than the window to show up properly ([#7058](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7058)) diff --git a/src/plugins/discover/public/application/components/default_discover_table/default_discover_table.tsx b/src/plugins/discover/public/application/components/default_discover_table/default_discover_table.tsx index 5bcc55666f7c..436a401527fe 100644 --- a/src/plugins/discover/public/application/components/default_discover_table/default_discover_table.tsx +++ b/src/plugins/discover/public/application/components/default_discover_table/default_discover_table.tsx @@ -192,14 +192,11 @@ const DefaultDiscoverTableUI = ({ * 1) prevent columns from changing size when more rows are added, and * 2) speed of rendering time of subsequently added rows. * - * First cell is skipped because it has a dimention set already, and the last cell is skipped to allow it to - * grow as much as the table needs. + * First cell is skipped because it has a fixed dimension set already. */ - tableElement - .querySelectorAll('thead > tr > th:not(:first-child):not(:last-child)') - .forEach((th) => { - (th as HTMLTableCellElement).style.width = th.getBoundingClientRect().width + 'px'; - }); + tableElement.querySelectorAll('thead > tr > th:not(:first-child)').forEach((th) => { + (th as HTMLTableCellElement).style.width = th.getBoundingClientRect().width + 'px'; + }); tableElement.style.tableLayout = 'fixed'; }