React-table: Pivot Columns / Group Header Incompatibility as of 6.5.2

Created on 31 Aug 2017  路  6Comments  路  Source: tannerlinsley/react-table

What version of React-Table are you using?

6.5.3 & 6.5.2, Working as of 6.5.1

What bug are you experiencing?

The table does not render when you have a configuration with pivoted columns that are not grouped and aggregated columns which are grouped. If all columns are grouped, three is no issue.

Uncaught TypeError: Cannot read property 'Header' of undefined
        let PivotParentColumn = pivotColumns.reduce(
          (prev, current) =>
            prev && prev === current.parentColumn && current.parentColumn,
          pivotColumns[0].parentColumn
        )

        let PivotGroupHeader = hasHeaderGroups && PivotParentColumn.Header
        PivotGroupHeader = PivotGroupHeader || (() => <strong>Pivoted</strong>)

Use https://codesandbox.io/s/X6npLXPRW (by clicking the "Fork" button) to reproduce the issue.

Broken (6.5.3): _Notice that first and last name are not grouped_
https://codesandbox.io/s/wyvor42vw

Working (6.5.3) _Notice that first and last name are now grouped_
https://codesandbox.io/s/n780jz8600

Working (6.5.1): _First and last name are not grouped, but the table is still working_
https://codesandbox.io/s/l599vz8277

What are the steps to reproduce the issue?

  1. Have a configuration where you have pivot columns which are not grouped and aggregated columns which are grouped.
  2. Render the table

Most helpful comment

I am having this issue as well. Is there a solution?

When I add a pivot (in version 6.8.2), I get:

methods.js:189 Uncaught TypeError: Cannot read property 'Header' of undefined
    at ReactTable.getDataModel (methods.js:189)
    at ReactTable.componentWillReceiveProps (lifecycle.js:61)
    at callComponentWillReceiveProps (react-dom.development.js:6892)
    at updateClassInstance (react-dom.development.js:7132)
    at updateClassComponent (react-dom.development.js:8345)
    at beginWork (react-dom.development.js:8982)
    at performUnitOfWork (react-dom.development.js:11814)
    at workLoop (react-dom.development.js:11843)
    at HTMLUnknownElement.callCallback (react-dom.development.js:100)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:138)

All 6 comments

This should be fixed in the latest version

It seems this was never fixed. I tried with every version from 6.5.2 to 6.7.6 and it's not working.

It won't currently work with the code provided by scrawfor because it defines parents for every column except the pivoted ones. If no columns have parents, it works.

Still not working. Considering a fork as this is mission-critical.

I am having this issue as well. Is there a solution?

When I add a pivot (in version 6.8.2), I get:

methods.js:189 Uncaught TypeError: Cannot read property 'Header' of undefined
    at ReactTable.getDataModel (methods.js:189)
    at ReactTable.componentWillReceiveProps (lifecycle.js:61)
    at callComponentWillReceiveProps (react-dom.development.js:6892)
    at updateClassInstance (react-dom.development.js:7132)
    at updateClassComponent (react-dom.development.js:8345)
    at beginWork (react-dom.development.js:8982)
    at performUnitOfWork (react-dom.development.js:11814)
    at workLoop (react-dom.development.js:11843)
    at HTMLUnknownElement.callCallback (react-dom.development.js:100)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:138)

This is not fixed, workaround is to put pivoted column into a header group as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dwjft picture dwjft  路  3Comments

panfiva picture panfiva  路  3Comments

tremby picture tremby  路  3Comments

monarajhans picture monarajhans  路  3Comments

ocalde picture ocalde  路  3Comments