From 7aa61e42bf362156e9d2feaba1a4f5ec069dccaf Mon Sep 17 00:00:00 2001 From: Miki Date: Wed, 19 Jun 2024 10:55:10 -0700 Subject: [PATCH] [Discover] Allow the last column of a table wider than the window to show up properly (#7058) Signed-off-by: Miki --- 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 00000000000..ff86e5e65b8 --- /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 5bcc55666f7..436a401527f 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'; }