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.

Use renderExpandableRow and onRowClick for expand row will have console warning.

See original GitHub issue

I have table with expanded row, for my understanding if I click the arrow icon will trigger renderExpandableRow setting, and if I have expandableRowsOnClick: true, then when I click the row not the > icon will trigger onRowClick function (correct me if I’m wrong) But when I add my custom click action in renderExpandableRow(click the arrow icon), then my row won’t be expanded and will have an error message in my console below. Any way I can trigger extra events for the renderExpandableRow option so I can fetch more data? Because some of my users click the icon instead of the whole row, so I need to fetch more data on both click events.

Here’s my codeSandBox Screen Shot 2020-07-07 at 8 02 58 PM

ndex.js:1437 Warning: Cannot update a component (ConnectFunction) while rendering a different component (n). To locate the bad setState() call inside n, follow the stack trace as described in https://fb.me/setstate-in-render in n (created by WithStyles(n)) in WithStyles(n) (created by t) in table (created by ForwardRef(Table)) in ForwardRef(Table) (created by WithStyles(ForwardRef(Table))) in WithStyles(ForwardRef(Table)) (created by t) in Unknown (created by t) in div (created by t) in div (created by ForwardRef(Paper)) in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper))) in WithStyles(ForwardRef(Paper)) (created by t) in t (created by WithStyles(t)) or this error you can see in my codeSandBox

Screen Shot 2020-07-07 at 8 15 36 PM

Thank you so much for your help!

Your Environment

Tech Version
Material-UI 4.11
MUI-datatables 3.1.3
React 16.8
browser chrome
etc

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
kalyan542commented, Sep 23, 2020

The renderExpandableRow method isn’t asynchronous, so you can’t do it like that.

One idea could be to return a component, and that component would handle making the API call and updating itself. Ex:

renderExpandableRow: (rowData, rowMeta) => {
    return <ExpandableRowEntry rowData={rowData} rowMeta={rowMeta} />
}

Thanks for the quick reply. It’s working as expected. Thank you

0reactions
patorjkcommented, Sep 22, 2020

The renderExpandableRow method isn’t asynchronous, so you can’t do it like that.

One idea could be to return a component, and that component would handle making the API call and updating itself. Ex:

renderExpandableRow: (rowData, rowMeta) => {
    return <ExpandableRowEntry rowData={rowData} rowMeta={rowMeta} />
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

fetch data when row click/expand use mui-datatables error
when they click one of row will goes fetch more data to display in the expand table rows. Question I have: 1. onRowClick...
Read more >
using unsafe_componentwillmount in strict mode is not ... - You.com
I use React for frontend, I am facing a warning in React. ... I'm keep getting error when I click one of row,...
Read more >
MUI Datatables: Datatables for React using Material-UI - Morioh
If your project doesn't already use them, you need to install mui v5 and it's ... other areas of the table (such as...
Read more >
fetch data when row clickexpand use mui-datatables error
fetch data when row click/expand use mui-datatables error I'm using ... using onRowClick with United renderExpandableRow, my nesting row ...
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