From a9255811ef0721ec0800065e8c06a0b3c312d171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Mill=C3=A1n?= Date: Wed, 13 Sep 2023 19:29:12 +0200 Subject: [PATCH] Fix filter actions on data table vis cells (#4837) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix filter actions on data table vis cells * Add changelog entry --------- Signed-off-by: Eva Millán Signed-off-by: Josh Romero Co-authored-by: Miki Co-authored-by: Josh Romero Co-authored-by: Anan Zhuang --- CHANGELOG.md | 1 + .../public/components/table_vis_component.tsx | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c6b42c6594f..5c57adc08883 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Table Visualization] Fix width of multiple tables when rendered in column view ([#4638](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4638)) - [Legacy Maps] Fix dark mode style overrides ([#4658](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4658)) - [BUG] Fix management overview page duplicate rendering ([#4636](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4636)) +- [Table Vis] Fix filter actions on data table vis cells ([#4837](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4837)) - Fix broken app when management is turned off ([#4891](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4891)) - Correct the generated path for downloading plugins by their names on Windows ([#4953](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4953)) diff --git a/src/plugins/vis_type_table/public/components/table_vis_component.tsx b/src/plugins/vis_type_table/public/components/table_vis_component.tsx index c0e4ab61ae8b..3d7602e9a991 100644 --- a/src/plugins/vis_type_table/public/components/table_vis_component.tsx +++ b/src/plugins/vis_type_table/public/components/table_vis_component.tsx @@ -37,7 +37,7 @@ export const TableVisComponent = ({ event, uiState: { sort, setSort, colWidth, setWidth }, }: TableVisComponentProps) => { - const { rows, formattedColumns } = table; + const { rows, columns, formattedColumns } = table; const pagination = usePagination(visConfig, rows.length); @@ -59,7 +59,15 @@ export const TableVisComponent = ({ formattedColumns, ]); - const dataGridColumns = getDataGridColumns(table, event, colWidth); + const sortedTable = useMemo(() => { + return { + rows: sortedRows, + columns, + formattedColumns, + }; + }, [sortedRows, columns, formattedColumns]); + + const dataGridColumns = getDataGridColumns(sortedTable, event, colWidth); const sortedColumns = useMemo(() => { if (