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.

How to rerender entire single row in react-table?

See original GitHub issue

I have a react-table component in my app and pass there next props:

<ReactTable
  data={this.props.words}
  columns={columns}
  getTrProps={changing_state_func}
/>

changing_state_func is a function that changes state of the component that wraps react-table. Specifically, this function fills an array that contains ids of the data objects for rows. So I’d like to highlight the rows with the data for those ids… Cannot figure it out how to do it.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
tannerlinsleycommented, Feb 3, 2017

I just published version 5.0.2 that gives you access to the table’s instance.

Try this:

changing_state_func = (state, rowInfo, column, instance) => {
  if (!rowInfo) return {}
  return {
    style: {
      background: (this.state.rowsIdsArray.includes(rowInfo.row.id)) ? 'green' : null
    },
    onClick: () => {
      this.setState({rowsIdsArray: this.state.rowsIdsArray.concat([rowInfo.row.id])});
      instance.forceUpdate()
    }
  }
}
1reaction
tannerlinsleycommented, Feb 3, 2017

You bet. 😊 On Fri, Feb 3, 2017 at 2:14 PM Oleg Zhermal notifications@github.com wrote:

That works! Thanks for the quick fix.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/tannerlinsley/react-table/issues/54#issuecomment-277363875, or mute the thread https://github.com/notifications/unsubscribe-auth/AFUmCaBAjjNNSR_ZeJTk0Qg5HqTi-p9Yks5rY5ihgaJpZM4L2X5W .

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to rerender entire single row in react-table? #54 - GitHub
I have a react-table component in my app and pass there next props: changing_state_func is a function that changes state of the component ......
Read more >
How to rerender entire single row in react-table?
2. It works just for initial rendering. · Once you change data property of <ReactTable /> component, then your rows will be updated...
Read more >
Create a Table in React | Learn how to view, add ... - YouTube
Create a Table in React | Learn how to view, add, delete and edit rows in a table from Scratch · Chapters. View...
Read more >
Only re-render edited cell - Issues - Handsontable Forum
It seems that after a cell has been edited, the whole table is re-rendered making all custom components re-render. Using React.memo doesn't ...
Read more >
React Table Tutorial:How to implement useTable and useFilter
I'll be writing the entire code in two files, i.e.,. App.js – main file; TableContainer.js – having a Table component. Importing Axios and...
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