Giter Club home page Giter Club logo

react-table-example's Introduction

React Table Example

Demo of React Table V7 using TypeScript as well as Material UI

This example uses:

  • useGroupBy to enable header groups
  • useFilters for per-column filters. Note that filters are displayed in a separate filter dropdown rather than being embedded in each column header.
  • useSortBy for column sorting
  • useExpanded to allow expansion of grouped columns
  • useFlexLayout for a scalable full width table
  • usePagination for pagination
  • useResizeColumns for resizable columns
  • useRowSelect for row selection

Other features:

  • Demonstrates hiding columns.
  • use react-json-view to optionally display the table instance for better exploration.
  • use useLocalStorage and useDebounce, both from https://usehooks.com to persist table settings.

Inspiration

Several parts of this demo are pulled from examples that are available at https://github.com/tannerlinsley/react-table/tree/master/examples that are copyright Tanner Linsley

react-table-example's People

Contributors

dependabot[bot] avatar ggascoigne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-table-example's Issues

Type issue

Typescript is complaining that isGrouped does not exist on type cell

{cell.isGrouped ? (

"typescript": "^4.2.4",
"react-table": "^7.6.3",
"@types/react-table": "^7.7.1",
"@material-ui/core": "^4.11.4",
"@material-ui/icons": "^4.11.2",

Property 'index' does not exist on type 'ColumnInstance<T>' with "@types/react-table": "7.0.29"

Hey @ggascoigne ,

I'm pretty new to react/ts world. I've been using one of your examples to modal creating tables and I've run into issues with the latest version of @types/react-table": "7.0.29" with react-table "react-table": "^7.6.3"

Inside your Table component im seeing:

Property 'index' does not exist on type 'ColumnInstance'. TS2339

52 | 
53 | function DefaultColumnFilter<T extends Record<string, unknown>>({

54 | column: { id, index, filterValue, setFilter, render, parent },
| ^
55 | }: FilterProps) {
56 | const [value, setValue] = React.useState(filterValue || '');
57 | const handleChange = (event: React.ChangeEvent) => {

When I downgrade to "@types/react-table": "7.0.28" I'm able to build again but I'd like to be running on lastest and greatest if possible.

Any help is appreciated,
Michael

OnEdit

How can I access to the selected row after select one row and click onEdit?

Why all the divs?

Why not use the Table element? It is the correct semantic element. People will copy this code and it is full of accessibility issues:

Screen Shot 2021-04-20 at 12 18 20

Bad code is bad code. You're not doing anyone any favors by making examples with bad code.

I'd hoped to use this, but now I have to rewrite it from scratch essentially. A shame.

Types for 'manualPagination', 'pageSize' and 'pageIndex'

The 'usePagination' API here - https://github.com/tannerlinsley/react-table/blob/master/docs/api/usePagination.md talks of 'initialState' and 'manualPagination' as two options that can be passed to useTable(options).

Is there an example in TS?

The current type definitions don't have manualPagination , 'pageSize' and 'pageIndex' defined.
Property 'manualPagination' does not exist on type 'TableOptions<D>'.

Should I be extending types here - https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-table

Loading indicator

Very nice work with the sample. How can i be able to indicate the table is loading.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.