React-table: Changing data doesn't work well with pivot functionality

Created on 4 Jan 2018  路  4Comments  路  Source: tannerlinsley/react-table

Hi, first of all, thank you for this awesome library, it really rocks!

v6.7.6

If I select a pivot and data is changed, pivot selection is not remembered and it's lost. This is very frustrating from a user point of view and one can't really use pivot functionality in case data may be changed.

https://codesandbox.io/s/jzkwrr91rv

Wouldn't it be possible if react-table somehow keeps pivot-related state persisted or tries to recover somehow in case 'pivotBy' categories stay the same?

Most helpful comment

Not at present. The Pivot information is tied to the sorting. So if data changes that will trigger an internal change to the data.

You could look at the following props (from the doco) and see if any of those help. But then you will be faced with a "dirty" page that won't represent the reality to the user....

  collapseOnSortingChange: true,
  collapseOnPageChange: true,
  collapseOnDataChange: true,
  freezeWhenExpanded: false,

All 4 comments

Not at present. The Pivot information is tied to the sorting. So if data changes that will trigger an internal change to the data.

You could look at the following props (from the doco) and see if any of those help. But then you will be faced with a "dirty" page that won't represent the reality to the user....

  collapseOnSortingChange: true,
  collapseOnPageChange: true,
  collapseOnDataChange: true,
  freezeWhenExpanded: false,

@gary-menzel thanks for your reply. What seems to be a big inconsistent here is that sorting is actually preserved, but pivot information/status is not.

Did you try any of those settings above? They control the expanding/collapsing of the additional rows for either Pivot or SubComponent. NOTE: Pivot and SubComponent use the same mechanism.

Setting collapseOnDataChange to false helped, thanks a lot. However I still think it could be a default.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mellis481 picture mellis481  路  3Comments

LeonHex picture LeonHex  路  3Comments

esetnik picture esetnik  路  3Comments

pasichnyk picture pasichnyk  路  3Comments

ocalde picture ocalde  路  3Comments