gregnb / gregnb/mui-datatables

Return original data entry in customRowRender

Open
#1,614 3 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

## Expected Behavior
The callback of customRowRender is returning for the first argument one array instead of the original data entry which is key based object

This can be fine, but we need also to get back the original data object key based instead of being converted to array.

That means that if I pass to

```

const COLUMNS = [
{
name: 'name',
label: 'Name',
},
{
name: 'surname',
label: 'Surname',
},
];

const data = [
{
name: 'kristi',
surname: 'jorgji',
}
];

return

```

I expect to be able to get the data object entry exactly with key structure somehow in the customRowRender instead of being in array format like below currently (I am simplifying here, but in real usage is complex data structure nested etc and such option is really needed, getting back in array format is not helpful.
```
[
0 => kristi
1 => jorgji
]
```

## Current Behavior
`customRowRender: (data) => {
console.log(data); // the data here will be array, cannot find any way to get back the original data structure
}`

## Your Environment

"@material-ui/core": "^4.11.1",
"mui-datatables": "^3.7.3",
"@types/mui-datatables": "^3.7.0",
"react": "^17.0.1",

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the customRowRender callback and trace how each data entry is transformed before the callback receives it. Compare the current array argument with the original key-based object described in the issue, including nested data. Done means customRowRender can access the original data structure rather than only positional values.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.