From 902148e202aa57b91dbbb1b730860c336727e02f Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Wed, 13 Sep 2023 10:36:58 -0700 Subject: [PATCH] Fix filter actions on data table vis cells (#4837) (#5000) 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 (cherry picked from commit a9255811ef0721ec0800065e8c06a0b3c312d171) Signed-off-by: github-actions[bot] --- .../public/components/table_vis_component.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 (