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

Paul6552 picture Paul6552  路  35Comments

Oskii2311 picture Oskii2311  路  46Comments

golan4ik picture golan4ik  路  18Comments

IPessers picture IPessers  路  20Comments

Grsmto picture Grsmto  路  100Comments