gregnb / gregnb/mui-datatables

Access original row object in customBodyRender, etc

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

Description

I would like to feed row-objects into the table and then access them in `customBodyRender` and other callbacks.

Use case:
I need to refer to data in the original row-object that I do not want to use in any column. For example. `` elements with menu items that are specific to the row being rendered. And the data id to update when that `` is changed.

Example data (just one row):
```
[
{
"key": "credit_processor",
"description": "Which processor integration to use for this client",
"value": "none",
"default": "none",
"options": [
"none",
"cardconnect",
"worldpay",
"econduit"
]
},
...
]
```

In other libraries I can easily access the original row data to populate my `` and to tell the server what data key is being updated `onChange`.

Here, I seem to have to make hidden columns with that information, and then keep track of the column indexes containing that data. The code is a lot harder to read and especially hard to maintain (adjusting indexes if new columns are added or removed).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how customBodyRender and the other callbacks receive row data, using the issue's example row object as the reference case. Determine how the original object can be exposed without hidden columns or column-index tracking. Done means row-specific Select options and update identifiers are available through the callback API.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.