Questions tagged [react-table-v7]

Hooks for building fast and extendable tables and datagrids for React. v7 was a major refactor of the library, eliminating the component for a headless hook-based data organization utility. For questions about the component and other deprecated methods from previous versions, use [react-table-v6]. For questions about the most recent version of react-table or the TanStack Table useReactTable hook, use [react-table].

The most recent version of react-table is the @tanstack/react-table adapter of the TanStack Table libary. This tag is specifically for questions about v7, which was a major refactor over previous versions, and differs in other ways from v8 and beyond.

Website

https://react-table-v7.tanstack.com/

Demos

https://react-table-v7.tanstack.com/docs/examples/basic

Docs

https://react-table-v7.tanstack.com/docs/overview

Example

const {
  getTableProps,
  getTableBodyProps,
  headerGroups,
  rows,
  prepareRow,
} = useTable({
  columns,
  data,
})

// Render the UI for your table
return (
  <table {...getTableProps()}>
    <thead>
      {headerGroups.map(headerGroup => (
        <tr {...headerGroup.getHeaderGroupProps()}>
          {headerGroup.headers.map(column => (
            <th {...column.getHeaderProps()}>{column.render('Header')}</th>
          ))}
        </tr>
      ))}
    </thead>
    <tbody {...getTableBodyProps()}>
      {rows.map((row, i) => {
        prepareRow(row)
        return (
          <tr {...row.getRowProps()}>
            {row.cells.map(cell => {
              return <td {...cell.getCellProps()}>{cell.render('Cell')}</td>
            })}
          </tr>
        )
      })}
    </tbody>
  </table>
)
227 questions
3
votes
2 answers

how to get react-table filtered/sorted data

I want to get the filtered data of react-table I found some answers Can't access resolved data in react-table, Access filtered data in ReactTable and Error accessing filtered data in React Table. but they all are using or…
RedHat
  • 53
  • 5
3
votes
1 answer

I am getting the Uncaught Error: Renderer Error when I try to render a table in react using react-table hook

I am quite new to development and just started with react. I have implemented a react-table and when rendered it in the App.js file but then I open the browser it does not render anything and gives an error in the consoleThis is the snapshot of the…
3
votes
2 answers

react-table row selection with custom field instead of index

I'm using the react-table package. I made a simple table with row selection. The problem is: The row selection result is an object with indexes: { 0: true, 1: true, ... } But I want to be the primary key of my data like this: { …
Anarno
  • 1,470
  • 9
  • 18
3
votes
2 answers

Is there a way to style individual cell using react-table based on the value?

I want to style individual cell in react-table but I am not able to do so. const MOCK_DATA = [ { amount: 1000, status: `SUCCESS`, updatedAt: 1629181927, }, { amount: 2000, status: `FAILED`, updatedAt: 1629181927, …
Vish
  • 142
  • 1
  • 8
3
votes
1 answer

Dynamically increase react-table height to fill screen size

Is this possible to dynamically increase table height, based on the browser window height, when using the virtualized react-table (example that I'm working with) ? There's lots of empty space in my browser that I wish it'll fill up, yet I don't wish…
ABC
  • 693
  • 1
  • 10
  • 22
3
votes
3 answers

Multiple react-table instances on same page

I'm using react-table in a NextJS project and I'm wondering how I can have more than one table on the same page. Been digging around but haven't found anything about it. I have an instance on the page already and I'm not sure if I'm over thinking it…
3
votes
1 answer

How to create a row with one cell in a expandible react table?

I want to use useExpanded to create a subrow that stretches along all columns, similar to the screenshot. In the react table example it only provides expanded rows with the same columns like the table header. const { getTableProps, …
vuvu
  • 4,886
  • 12
  • 50
  • 73
3
votes
1 answer

React-Table Column Hiding

I'm kind of new to React and Web development in general . I have a scenario , to create a table in react , and create a box that would enable to show/hide the columns with it , and along with it a select all checkbox that would show or hide all…
3
votes
3 answers

trouble with React Table 7 unique key warning

I am using React Table 7 to build my tables, and the tables render but I'm getting a warning Each child in a list should have a unique "key" prop. I have included keys in the headerGroup map and the rows but am still getting the warning. There error…
3
votes
1 answer

How do I stop react-table v7 useTable state being shared?

I have a component that creates a react table which works as expected when there is just one page involved: const ReactTable = (props) => { const {data, columns, viewState, updateViewState} = props; const defaultColumn = React.useMemo(() =>…
Paul Whipp
  • 16,028
  • 4
  • 42
  • 54
3
votes
0 answers

Can't access resolved data in react-table

I know this has been asked a few times on StackOverflow, but I haven't made any of the previous answers work for me. I'm looking to take a react-table component, and allow the user to download the filtered data currently rendered as a CSV. I know…
jon-perrett
  • 94
  • 1
  • 6
3
votes
3 answers

React-Table: Select Single Row Only, Disable Multiple Row Selection

I am using radio buttons to select the rows. How do I disable multiple row selection so only one row can be selected at a time? I am using selectedFlatRows, but it's allowing for multiple row selection. const Table = props => { const { …
SAKURA
  • 937
  • 11
  • 29
3
votes
0 answers

how to add a new row using react-table v7

i am using react-table v7. What i want to achieve is to add a new row below a row when a button is clicked. Like jquery datatables https://datatables.net/ when name is clicked a new row is added into the table, how can i do the same with react-table…
Nabeel Hussain Shah
  • 774
  • 2
  • 9
  • 15
3
votes
1 answer

How to prevent react-table sort and search reset

In this official example, table sorting and searching resets on blur of any editable field.https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/kitchen-sink?file=/src/App.js How can I prevent that? I want sort and search to…
Asela
  • 303
  • 1
  • 5
  • 16
3
votes
0 answers

Fully Controlled server side filtering with pagination in react-table (v7) with Laravel 6+

I was working with React-Table v7 with API on Laravel 6+. I am done with pagination but now I would like to implement serverside filtering with multiple columns. I want a simple example of filtering in react-table v7 with laravel as server
1 2
3
15 16