gregnb / gregnb/mui-datatables

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

Open
#1,392 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

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](https://codesandbox.io/s/wonderful-noether-pq5oj?file=/src/App.js)
![Screen Shot 2020-07-07 at 8 02 58 PM](https://user-images.githubusercontent.com/26178313/86863486-e4858280-c090-11ea-9007-1576a997cf83.png)

`
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](https://codesandbox.io/s/wonderful-noether-pq5oj?file=/src/App.js)

![Screen Shot 2020-07-07 at 8 15 36 PM](https://user-images.githubusercontent.com/26178313/86863522-f9faac80-c090-11ea-823e-7e797f63d6f6.png)

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.