Also, please don't be that person who deletes this template. It's here for a reason.
Thanks!
✅ Officially supported ✅
⚠️ Not officially supported, expect warnings ⚠️
☣️ Not officially supported, expect warnings and errors ☣️
✅ Officially supported ✅
⚠️ Not officially supported, but "should work" ⚠️
👋 Need general support? Not sure about how to use React itself, or how to get started with the Grid?
Please do not submit support request here. Instead see
https://github.com/adazzle/react-data-grid/blob/master/CONTRIBUTING.md
Please include:
- What the current behavior is
- What the desired behvaior is
- (If Bug) Steps to reproduce the issue
- (If Feature) The motivation / use case for the feature
We especially love screenshots / videos of problems, and remember
The Best Issue Is A Pull Request™
have read several discussions of passing row data into formatters but have not seen how the Formatter handles the row data specifically in the static propTypes{} block. This of course is in the case of a Formatter which is a separate class.
In the render method of the formatter pull in the row data const rowData = this.props.dependentValues();
look at what is there and decide how you want to use it.
I know this is old but i also needed something like this. not sure how your solution worked as dependentValues isn't a method in the scope of the formatter. however, this is how i've got it working:
in the column definition, specify getRowMetaData function something like:
formatter: MyCustomFormatter,
getRowMetaData: (rowData, columnInfo) => {
return {rowData, columnInfo};
}
Now, in your formatter (this.props.dependentValues), you'll get whatever the you've returned here (in case of this example it'll be current row data and column config)
Most helpful comment
I know this is old but i also needed something like this. not sure how your solution worked as
dependentValuesisn't a method in the scope of the formatter. however, this is how i've got it working:in the column definition, specify
getRowMetaDatafunction something like:Now, in your formatter (
this.props.dependentValues), you'll get whatever the you've returned here (in case of this example it'll be current row data and column config)