Missing API to get row content for Functional Rendering
See original GitHub issueFeature description
I want to use ReactTable’s logic but its default output doesn’t quite fit my needs. I would like to have a totally custom JSX tree structure, so overriding the defaults for TableComponent
, TrComponent
etc. is not an option.
I thought it would be an easy feat to implement something like that with Functional Rendering but after hours of searching and digging through the code I haven’t found any way to get the contents of individual cells. I mean there’s the state.resolvedData
which is filtered and sorted, but I would still have to reimplement all the logic behind column accessors (and probably other things), which isn’t exactly simple…
Use case
The ideal code would look like this (assuming the API for getting the content would be state.rows
):
class MyTable extends React.Component
{
render() {
return (
<ReactTable
columns={this.props.columns}
data={this.props.data}
>
{
(state, makeTable, instance) =>
(
<WhateverWrappingElement>
{
state.rows.map( r => (
<MyRow>
{
r.map( d => (<Cell children={d} />) )
}
</MyRow>
));
}
</WhateverWrappingElement>
)
}
</ReactTable>
);
}
}
Is it something that exists in React Table and is just undocumented, or is it missing completely from the implementation?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
A v7 alpha is available to tinker with right now, and there is a codesandbox on the readme which shows its capabilities and promise 😃. Though, there are no docs yet. The API is still a tad bit in flux, but its mostly calmed down. Now is just a matter of testing certain patterns, writing tests, and writing docs.
Closing due to issue age. If this issue was a question, please ask it again on https://spectrum.chat/react-table. If you think this issue needs to be reopened or if it should be turned into a pull-request, please check the latest version of React-Table for the issue or feature once more and reopen or create a PR if appropriate. Thanks!