From 024943a0bc8650c94ecb538e33eeaf980347447b Mon Sep 17 00:00:00 2001 From: Helene Rigner Date: Thu, 16 May 2019 10:44:40 +0200 Subject: [PATCH] Using qEffectiveInterColumnSortOrder to fetch right index in qmatrix --- src/components/hypercube-table.jsx | 28 +++++++++++++++------------- src/components/hypercube-table.pcss | 4 ++++ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/components/hypercube-table.jsx b/src/components/hypercube-table.jsx index 9a3db36f..aea88ad7 100644 --- a/src/components/hypercube-table.jsx +++ b/src/components/hypercube-table.jsx @@ -8,29 +8,31 @@ import useResolvedValue from './use/resolved-value'; import './hypercube-table.pcss'; -function cellGetterForIndex(index) { +function cellGetterForIndex(index, layout) { return function cellGetter({ rowData }) { - if (!rowData || !rowData[index]) { + const indexInQMatrix = layout.qHyperCube.qEffectiveInterColumnSortOrder.indexOf(index); + if (!rowData || !rowData[indexInQMatrix]) { return ''; } - return rowData[index].qText; + return rowData[indexInQMatrix].qText; }; } -function cellRendererForIndex(index) { +function cellRendererForIndex(index, layout) { function cellRenderer({ rowData }) { - if (!rowData || !rowData[index]) { + const indexInQMatrix = layout.qHyperCube.qEffectiveInterColumnSortOrder.indexOf(index); + if (!rowData || !rowData[indexInQMatrix]) { return (
...
); } let title; - if (!rowData[index].qNum || rowData[index].qNum === 'NaN') { - title = `'${rowData[index].qText || ''}' (No numerical representation)`; + if (!rowData[indexInQMatrix].qNum || rowData[indexInQMatrix].qNum === 'NaN') { + title = `'${rowData[indexInQMatrix].qText || ''}' (No numerical representation)`; } else { - title = `'${rowData[index].qText}' (Numerical representation: ${rowData[index].qNum})`; + title = `'${rowData[indexInQMatrix].qText}' (Numerical representation: ${rowData[indexInQMatrix].qNum})`; } return (
- {rowData[index].qText ? rowData[index].qText : '< empty >'} + {rowData[indexInQMatrix].qText ? rowData[indexInQMatrix].qText : '< empty >'}
); } @@ -183,8 +185,8 @@ export default function HypercubeTable({ key={dim.title} width={getDimensionWidth(layout, dimensionIndex, dim.title)} flexGrow={1} - cellDataGetter={cellGetterForIndex(dimensionIndex)} - cellRenderer={cellRendererForIndex(dimensionIndex)} + cellDataGetter={cellGetterForIndex(dimensionIndex, layout)} + cellRenderer={cellRendererForIndex(dimensionIndex, layout)} headerRenderer={columnHeaderRenderer} /> )) @@ -198,8 +200,8 @@ export default function HypercubeTable({ columnData={measure} key={measure.title} flexGrow={1} - cellDataGetter={cellGetterForIndex(dimensions.length + measureIndex)} - cellRenderer={cellRendererForIndex(dimensions.length + measureIndex)} + cellDataGetter={cellGetterForIndex(dimensions.length + measureIndex, layout)} + cellRenderer={cellRendererForIndex(dimensions.length + measureIndex, layout)} headerRenderer={columnHeaderRenderer} /> )) diff --git a/src/components/hypercube-table.pcss b/src/components/hypercube-table.pcss index 18b61180..2bce066b 100644 --- a/src/components/hypercube-table.pcss +++ b/src/components/hypercube-table.pcss @@ -83,4 +83,8 @@ .ReactVirtualized__Table__rowColumn:last-of-type { border-right: none; } + + .ReactVirtualized__Table__headerRow { + text-transform: none; + } }