From b01c42688e0b17f49f60e7394bc6163d8f49d9e1 Mon Sep 17 00:00:00 2001 From: loi Date: Wed, 23 Oct 2024 14:44:15 -0700 Subject: [PATCH] IRSA-6431: Firefly tables in expanded mode was unable to switch tabs. --- src/firefly/html/test/tests-table.html | 2 +- src/firefly/js/tables/ui/TablesContainer.jsx | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/firefly/html/test/tests-table.html b/src/firefly/html/test/tests-table.html index 07fe1d736..7a885d582 100644 --- a/src/firefly/html/test/tests-table.html +++ b/src/firefly/html/test/tests-table.html @@ -507,7 +507,7 @@

use tbl.relatedCols to highlight related rows

const table2 = { tbl_id: 'table2', tableData: { columns, data } }; const table3 = { tbl_id: 'table3', tableData: { columns, data } }; firefly.showClientTable('single', table1); - firefly.showClientTable('single', table2); + firefly.showClientTable('tabs', table2); firefly.showClientTable('tabs', table3); [2,3].forEach(i => { const {tbl_ui_id} = firefly.util.table.getTableUiByTblId("table"+i); diff --git a/src/firefly/js/tables/ui/TablesContainer.jsx b/src/firefly/js/tables/ui/TablesContainer.jsx index f7f4ae8a9..07a2706e5 100644 --- a/src/firefly/js/tables/ui/TablesContainer.jsx +++ b/src/firefly/js/tables/ui/TablesContainer.jsx @@ -24,23 +24,17 @@ const logger = Logger('Tables').tag('TablesContainer'); export function TablesContainer(props) { const {mode='both', closeable=true, tableOptions, style, expandedMode:xMode=false} = props; - let {tbl_group} = props; + const expandedMode = useStoreConnector(() => xMode || getExpandedMode() === LO_VIEW.tables); + const tbl_group = expandedMode && mode !== 'standard' ? TblUtil.getTblExpandedInfo().tbl_group : props.tbl_group; const tables = useStoreConnector(() => TblUtil.getTableGroup(tbl_group)?.tables); const active = useStoreConnector(() => TblUtil.getTableGroup(tbl_group)?.active); - const expandedMode = useStoreConnector(() => xMode || getExpandedMode() === LO_VIEW.tables); useStoreConnector((lastTitles) => {// force a rerender if any title ui changes const titles= getTblIdsByGroup().map( (tbl_id) => getTableUiByTblId(tbl_id)?.title); if (!lastTitles) return titles; return (union(titles,lastTitles).length === titles?.length) ? lastTitles : titles; }); - useEffect(() => { - if (expandedMode && mode !== 'standard') { - tbl_group = TblUtil.getTblExpandedInfo().tbl_group; - } - }, [expandedMode, mode]); - logger.debug('render... tbl_group: ' + tbl_group); if (expandedMode) {