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
1
vote
1 answer

React Table - setting up a collapsible row of data

I am currently trying to implement React-Table, with a data structure which matches this typescript definition. export type VendorContent = { id: number; name: string; user_name: string; dob: string; }; export type VendorData = { vendor:…
Squiggs.
  • 4,299
  • 6
  • 49
  • 89
1
vote
2 answers

How to add value to custom Input Field in React Table Library

I have created a products table. The table has an input field for quantity where the user can add a quantity for a specific product and then add it to the cart. However, when I type in the input field the values keep disappearing. I was able to get…
1
vote
0 answers

How to toggle row selection mode in react-table v7 with useRowSelect

I'm facing a problem with react-table v7.8.0 and useRowSelect plugin. All I want is to toggle the selection mode by setting a state variable, so that I'm able to show or hide the additional selection column just by clicking a button like "toggle…
calli23
  • 79
  • 9
1
vote
0 answers

React-table: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate

I am using React-table for one of my projects. I implemented the row selection as mentioned in the docs. below is my table.js import React, { useEffect, useMemo } from 'react' import { useTable, usePagination, useRowSelect } from…
Ashu
  • 77
  • 5
1
vote
0 answers

react-table custom sortType not able to sort columns

I'm trying to define a custom sorting function in a column def using react-table . However, when using this custom function the table columns are not sortable. I think there is something incorrect with my syntax. This works (I am able to sort the…
meerkat
  • 932
  • 2
  • 14
  • 38
1
vote
0 answers

react-table -- data disappears when clicked on a button in table row

I am newbie to react-table, having started using it for a week now. I was able to get the table rows and also infinite scrolling working. However, when I click on the delete icon in a row, the table becomes empty. From the web inspector, I can see…
Mopparthy Ravindranath
  • 3,014
  • 6
  • 41
  • 78
1
vote
1 answer

react-table -- how to set background color for column headers only

I am using react-table utility to power up my table, as below. 1 import {useTable} from 'react-table' 2 import {useMemo} from 'react' 3 import {Table } from 'react-bulma-components' 4 5 export default function…
Mopparthy Ravindranath
  • 3,014
  • 6
  • 41
  • 78
1
vote
1 answer

Selected rows always resetting when click on toggle sidebar

Please find the code link https://codesandbox.io/s/funny-phoebe-ux3e5?file=/src/nestead-table/index.js select any records from the table and then click on the Toggle side bar the selected checkbox is getting reset always. Please help Thanks in…
Ajay
  • 29
  • 7
1
vote
0 answers

React-table global filter Regex

Having trouble getting my GlobalFilter to update the table when using Regex to search for multiple results in a column. export const Table = ({ data, columns }) => { const filterTypes = useMemo( () => ({ // Override the default text…
codeRecon
  • 31
  • 3
1
vote
0 answers

React table - Force to stop rerender cell

I'm using React Table, I have custom Cell in one row, it's price chart component, my component is rendering the chart in that cell. But I have that update every 3 seconds, with new data, but I don't have new data for price chart component, so chart…
makiTurbo
  • 79
  • 3
  • 6
1
vote
1 answer

How does react-table v7.7.9 work in typescript with global filtering

I have a react-table that is working nicely in typescript. const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = useTable( { columns, data } ); I would like to add global filtering. If I simply add the plugin hook,…
theycallmemorty
  • 12,515
  • 14
  • 51
  • 71
1
vote
1 answer

React table 7 gives issue for unique key

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 all of the map function and the rows but am still getting the warning. Each…
Saif Farooqui
  • 116
  • 2
  • 12
1
vote
0 answers

Disable specific rows in react-table

I am using react-table v7.6.3 where I am allowing users to edit some data in the table. I intend to use WebSockets to prevent another user from editing the same row of data that a user is already editing. For that, I need to disable rows in…
1
vote
0 answers

How to set react-table column filter as sticky when scrolling vertically?

I am working on react-table. I have an issue with the vertical scroll. When the table scroll's vertically the filter moves with the scroll. Is it possible to place a filter static, when scrolling vertically? See this Image Image 2 Table CSS …
1
vote
1 answer

How to virtualize columns in react table

We have use case to render more than 1000 columns with 100 rows (max). Now we need to virtualize column wise instead of row wise. Is there is anyway to achieve it in react-table?
Harish_N
  • 2,249
  • 3
  • 23
  • 34