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...
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?
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!
@tannerlinsley I have the exact same use-case where I would want to rebuild the entire table to render a PDF but I'm not finding anything about the cell contents in the state. Was this issue closed because there's simply no way of achieving this with the current API?
What you're referring to is headless rendering which is not available in v6, but will be in v7. All of v7 is just a hook and pure API goodness. :)
thanks for the quick reply!
is there any ETA for v7?
sounds like a lot of refactoring in the near future :)
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.
Most helpful comment
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.