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.

[DataTable]: the table content doesn't re-render the changes when I update rows propos

See original GitHub issue

What package(s) are you using?

  • carbon-components
  • carbon-components-react

Detailed description

The table cells doesn’t reflect the changes, when I updated an item in rows(DataTable propos). I can see the changes just when I add an extra item, or remove one.

React codeSandbox : https://codesandbox.io/s/carbon-datatable-render-issue-zt2gc?file=/index.js

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
emyarodcommented, Mar 5, 2021

you’re right that it isn’t resolved specifically in the DataTable component due to its built in state manager, and I think the custom table route should be the way to go in the long run. I believe we should view the DataTable like ModalWrapper in that it is more of an example than a consumable component. Because there are many different use cases for managing table state, supporting every possible use case in DataTable would be extremely complex. so ultimately I think the solution is to allow consumers to use implement their own custom state manager with the Carbon table primitives as shown in the sandbox above. that being said I’m interested in hearing more opinions about this

1reaction
HafidZiticommented, Mar 3, 2021

most likely you would need to implement this with a custom state manager, meaning you would be implementing that logic using Carbon table primitives like Table, TableHead, TableRow, etc. rather than using the built in state manager in DataTable, if that makes sense

That’s what I’ve done, and it works, it’s just because in our project we often use DataTable, it’s less lines of code 😃 Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Table do not rerender after data change. When I update data ...
I have data coming in as a prop like below. I usually click a button in the parent component to change the prop...
Read more >
ReactJS - Data Table did not re-render/update when state ...
I'm a reactJS fresher, and I've got a issue as I wrote on title. I saw that adding more product into ProductList by...
Read more >
Rerender the datatable row after update
With server-side processing, the data shown in the table is basically readonly. Any change to the data needs a re-read from the server....
Read more >
React re-renders guide: everything, all at once - Developer way
Comprehensive guide on React re-renders. The guide explains what are re-renders, what is necessary and unnecessary re-render, ...
Read more >
MDBDataTable data does not render on state change
which means the row is deleted, even the message "Showing 1 to 1 of 1 entries" is updated from 2 to 1. but...
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