question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expanded state based on row data

See original GitHub issue

It 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:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

1reaction
tannerlinsleycommented, Aug 3, 2019

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 Example

0reactions
tannerlinsleycommented, Aug 3, 2019

It’s on my list for sure. On Aug 3, 2019, 3:09 PM -0600, Gajus Kuizinas notifications@github.com, wrote:

Off-topic to this conversation, but it would be nice if v7 came with v6 theme. Lack built-in/ available ready-made styles is the primary reason for not migrating at the moment. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found