From c57d0bf1b7d9d21b37f7ab912eea782d6f12b8ae Mon Sep 17 00:00:00 2001 From: Vittorio Cellucci Date: Wed, 9 Nov 2022 05:26:48 -0500 Subject: [PATCH] fix: totals line count for ios --- ios/ContainerView.swift | 10 ++++++---- src/components/SimpleGrid.tsx | 29 ++++++++++++++++++----------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/ios/ContainerView.swift b/ios/ContainerView.swift index b2e25c47..5e9e39bd 100644 --- a/ios/ContainerView.swift +++ b/ios/ContainerView.swift @@ -213,11 +213,11 @@ class ContainerView: UIView { tableViewFactory.create() firstColumnTable = tableViewFactory.firstColumnTableView multiColumnTable = tableViewFactory.multiColumnTableView - + setNeedsLayout() DispatchQueue.main.async { self.horizontalScrollView?.setContentOffset(CGPoint(x: 0, y: 0), animated: false) - self.testTruncation() self.firstColumnTable?.dataCollectionView?.postSignalVisibleRows() + self.testTruncation() } } else { guard let firstColumnTable = self.firstColumnTable else { return } @@ -262,6 +262,7 @@ class ContainerView: UIView { multiColumnTable?.updateGrabbers(height) firstHeader.layoutIfNeeded() multiHeader.layoutIfNeeded() + layoutIfNeeded() } testTotals() } @@ -276,11 +277,12 @@ class ContainerView: UIView { // uses cellcontent style for style, but header.wrap for checking wrap if lineCount != maxTotalsLineCount { maxTotalsLineCount = lineCount - let height = Double(maxHeaderLineCount) * (cellStyle?.lineHeight ?? 1.0) + let height = Double(maxTotalsLineCount) * (cellStyle?.lineHeight ?? 1.0) firstTotal.dynamicHeight.constant = height + (PaddedLabel.PaddingSize * 2.0) multiTotal.dynamicHeight.constant = height + (PaddedLabel.PaddingSize * 2.0) firstTotal.layoutIfNeeded() multiTotal.layoutIfNeeded() + layoutIfNeeded() } } @@ -294,7 +296,7 @@ class ContainerView: UIView { maxCollectionViewsLineCount = lineCount first.setMaxLineCount(maxCollectionViewsLineCount) multi.setMaxLineCount(maxCollectionViewsLineCount) - + layoutIfNeeded() } } diff --git a/src/components/SimpleGrid.tsx b/src/components/SimpleGrid.tsx index 15904a3e..7696b19f 100644 --- a/src/components/SimpleGrid.tsx +++ b/src/components/SimpleGrid.tsx @@ -110,18 +110,25 @@ const SimpleGrid: React.FC = ({ [expandCell] ); - const signalSearch = useCallback(async (column: any) => { - try { - const props = await model.getEffectiveProperties(); - - if( props?.qHyperCubeDef?.qDimensions[column.dataColIdx].qDef.qFieldDefs[0] ) { - column.label = props?.qHyperCubeDef?.qDimensions[column.dataColIdx].qDef.qFieldDefs[0]; - } - searchColumn({searching: true, column}) - } catch (error) { + const signalSearch = useCallback( + async (column: any) => { + try { + const props = await model.getEffectiveProperties(); - } - }, [searchColumn]) + if ( + props?.qHyperCubeDef?.qDimensions[column.dataColIdx].qDef + .qFieldDefs[0] + ) { + column.label = + props?.qHyperCubeDef?.qDimensions[ + column.dataColIdx + ].qDef.qFieldDefs[0]; + } + searchColumn({ searching: true, column }); + } catch (error) {} + }, + [model, searchColumn] + ); const onSearchColumn = useCallback( (event: any) => {