question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing API to get row content for Functional Rendering

See original GitHub issue

Feature 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:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
tannerlinsleycommented, Mar 27, 2019

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.

2reactions
tannerlinsleycommented, May 24, 2018

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-table not showing newly fetched data when rendering
I have made a useEffect hook which calls an async function which fetches new data on every render and I am passing that...
Read more >
deferRender - Render missing nodes dynamically - DataTables
At the moment the only way to get DataTables to generate the "missing" nodes is to have it draw them on screen. There...
Read more >
How To Handle Async Data Loading, Lazy Loading, and Code ...
When you use React functional components for example, as… ... in the correct shape or if you do not get any data at...
Read more >
JavaScript Data Grid: Cell Renderer - AG Grid
You might be wondering how the grid knows if you have provided a Cell Renderer component class or a simple function, as JavaScript...
Read more >
Examples • reactable - GitHub Pages
columns = list( Price = colDef( aggregate = JS("function(values, rows) ... Simplify JavaScript render functions that need access to data outside of the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found