gregnb / gregnb/mui-datatables
customBodyRender sometimes receives tableMeta.rowData[0] as undefined and sometimes as data object
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 906
- PR merge metrics
- No merged PRs in 30d
Description
## Question:
I have 2 instances of the table implemented.
I have found that in one table the customBodyRender's second parameter receives tableMeta.rowData index 0 as the entire data object, but in the other implementation tableMeta.rowData index 0 is undefined.
What configuration determines whether the data object is passed as index 0 of tableMeta.rowData?
## Column definition:
resourceName: {
name: 'resourceName',
label: 'Resource Name',
options: {
filter: true,
sort: true,
sortDirection: 'none',
customBodyRender: (value, tableMeta) => {
const rowData = tableMeta.rowData[0];
return (
{value}
);
}
}
}
## Your Environment
| Tech | Version |
|--------------|---------|
| Material-UI | 4.5.1 |
| MUI-datatables | 2.14.0 |
| React | 16.11.0 |
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the customBodyRender callback in the resourceName column definition and reproduce the behavior with the two table implementations described. Compare their configurations and inspect how tableMeta.rowData is assembled in the affected versions. Done means identifying the configuration difference that causes rowData[0] to be undefined or the full data object, with a confirmed explanation or regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100