Expanded state based on row data
See original GitHub issueIt would be nice to be able to store expanded rows based on row data (ideally a row id if such exists). This would be really helpful if we want to store user preferences on expanded rows or dynamically expand a row based on a pivot value.
At the moment it seems that expanded state is stored based on row indices, but these are not unique to the rows and they change as the sorting changes in the table for example.
Would such an improvement be possible?
Using React 16.4.6 Using react-table 6.7.11
We could add a new prop, a function returning a string from the row value and if this is set we should change this code (line 466 in index.js) to use that accessor instead of the row index?
const rowInfo = {
original: row[originalKey],
row,
index: row[indexKey],
viewIndex: (rowIndex += 1),
pageSize,
page,
level: path.length,
**nestingPath: path.concat([i]),**
aggregated: row[aggregatedKey],
groupedByPivot: row[groupedByPivotKey],
subRows: row[subRowsKey],
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:6
Top Results From Across the Web
Expanded controlled state is based on sorted row data #483
If you expand a row while maintaining a expanded control state, then sort the data, the wrong row will be expanded. Perhaps the...
Read more >Expanded row getting collapsed on state update on react-table
I'm using session storage to cache the expanded row, therefore after update it stays open. { JSON.parse(sessionStorage.
Read more >Expanding | TanStack Table Docs
Returns a function that can be used to toggle the expanded state of the row. This function can be used to bind to...
Read more >Expand, collapse, or show details in a PivotTable or PivotChart
In a PivotTable or PivotChart, you can expand or collapse to any level of data detail, and even for all levels of detail...
Read more >Controlling the Expanded State - Grid - Kendo UI for Angular
The Grid provides a built-in directive to simplify controlling the expanded state of a master-detail row. The kendoGridExpandDetailsBy directive automatically ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
v6 I’ll admit was very difficult to do this and honestly I wouldn’t even advise attempting it. v7 on the other hand, is built to handle this easily. You can read the documentation in the readme for the
useExpanded
hook , or look at the Expanding - Client Side ExampleIt’s on my list for sure. On Aug 3, 2019, 3:09 PM -0600, Gajus Kuizinas notifications@github.com, wrote: