* size-snapshot created?
* Added docz for documentation site
* Modified .gitignore to get rid of .docz internal stuff
* Update all doc links to point to proper paths with docz
* Removed .docz folder from Git
Co-authored-by: Jason Clark <jason.clark@tcnbroadcasting.com>
* Adds dev dependency on Scarf, default opt-out. Corresponding installation instructions
* Scarf as default opt in, moved to dependencies
* Update install docs for default opt in analytics
* Remove extra period
* update yarn lock
* size-snapshot created?
* Added `disableGlobalFilter` prop and associated tests
* Updated documentation
* improvement(useglobalfilter): add `disableGlobalFilter` prop
Adding `disableGlobalFilter` prop to both table and column to allow columns to be excluded from
Global Filter
* test(usefilters.test.js): added base test for disableGlobalFilter
Needed a test to make sure that disableGlobalFilter didn't break anything when applied
* Delete .size-snapshot.json
* Update README.md
Co-authored-by: Jason Clark <jason.clark@tcnbroadcasting.com>
Co-authored-by: Tanner Linsley <tannerlinsley@gmail.com>
* docs(examples/material-ui-enhanced-table): add more Material UI table
This enhanced Material UI table demonstrates client side pagination, sorting, global search, add
row, and delete row.
* Update EnhancedTable.js
Co-authored-by: Tanner Linsley <tannerlinsley@gmail.com>
* Add option to allow toggleRowSelect to not select subRows
Iif you are using manualGrouping, it's convenient to be able
to select the group without selecting all of the children.
This adds an instance option `selectChildRows`, which defaults to true,
that can be set to false to allow selection of the group without it
selecting all of the children.
* fix lint error
Co-authored-by: Tanner Linsley <tannerlinsley@gmail.com>
addresses https://github.com/tannerlinsley/react-table/issues/1808
Several of the instance methods added by plugins wrap their state update
functions in useCallback, the ones that didn't do this can lead to problems
where when they are used in a component, for instance in a hook, their
required presence in the dependency array causes an infinite loop as
executing the function triggers an instance update and a new function
generation. This PR addresses this.
Co-authored-by: Tanner Linsley <tannerlinsley@gmail.com>
* Add fixed width column support to useFlexLayout
* Allow useFlexLayout to honor canResize by calculating flex width separately from total width.
* Update example to show the selection checkbox since that's a common fixed width use case.
* Add example for right aligning columns.
* Tweaked the styles for the table to better align the resize handles (since it made verifying the rest easier when they weren't misaligned by the scroll bar width)
Note that the resize behavior is still rather strange, but that's a separate problem that this change didn't really effect.
* swich to react-table@latest
* docs(useglobalfilter.md): corrected documentation for setGlobalFilter
* fix(useglobalfilter.js): wrapped setGlobalFilter in useCallback
Wrapped setGlobalFilter in useCallback for identity stability.
- Fixed an issue where dependency hooks were not being reduced properly, thus the table would rerender unnecessarily
- Renamed `toggleRowSelectedAll` to `toggleAllRowsSelected`. Duh...
- Added an `indeterminate` boolean prop to the default props for row selection toggle prop getters
- Renamed `selectedRowPaths` to `selectedRowIds`, which also no longer contains paths, but row IDs
- Grouped or nested row selection actions and state are now derived, instead of tracked in state.
- Rows now have a new property called `id`, which existed before and was derived from the `getRowId` option
- Rows now also have an `isSomeSelected` prop when using the `useRowSelect` hook, which denotes that at least one subRow is selected (if applicable)
- Rows' `path` property has been deprecated in favor of `id`
- Expanded state is now tracked with row IDs instead of paths
- RowState is now tracked with row IDs instead of paths
- `toggleExpandedByPath` has been renamed to `toggleExpandedById`, and thus accepts a row ID now, instead of a row path
- The exported (but undocumented) `applyHooks` function has been deprecated. Please use either `reduceHooks` or `loopHooks` utilities in your custom plugins now.
- The exported (but undocumented) `applyPropHooks` function has been deprecated. Please use the `makePropGetter` utility in your custom plugins now.
- Added the `reduceHooks` exported utility which is used to reduce a value through a collection of hooks. Each hook must return a value (mutation is discouraged)
- Added the `loopHooks` exported utility which is used to loop over a collection of hooks. Hooks are not allowed to return a value (mutation is encouraged)
- Prop-getter hook functions now support returning an array (in addition to the typical object of props). When an array is returned, each item in the array is smart-merged into a new props object (meaning it will intelligently compose and override styles and className)
- Added the `makePropGetter` exported utility which is used to create prop getters from a prop getter hook.
- Prop-getter function supplied to the table have 2 new overloaded options (in addition to the typical object of props):
- `Function(props, instance, ...row/col/context) => Array<props> | props` - If a function is passed to a prop getter function, it will receive the previous props, the table instance, and potentially more context arguments. It is then be expected to return either an array of new props (to be smart-merged with styles and classes, the latest values taking priority over the previous values) or a props object (which will replace all previous props)
- `Array<props>` - If an array is passed to a prop getter function, each prop object in the array will be smart-merged with styles and classes into the props from previous hooks (with the latest values taking priority over the previous values).
- Extracted default hooks into separate file.
- Added the `useOptions` plugin hook, which allows a plugin to reduce/modify the initial options being passed to the table
- Converted almost all usages of `instanceRef.current` to use `useGetLatest(instanceRef.current)` to help with avoiding memory leaks and to be more terse.
- Converted all previous prop-getter definitions to use the new `makePropGetter`
- Reorganized plugin hooks to declare as many hooks in the main plugin function as opposed to in the `useInstance` hook.
- Changed the `useInstanceBeforeDimensions` hook to be a `loopHooks` call instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to discourage mutation of the instance)
- Changed the `useInstance` hook to be a `loopHooks` call instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to discourage mutation of the instance)
- Change the `prepareRow` hook to be a `loopHooks` call instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to discourage mutation of the row)
- The `columnsBeforeHeaderGroups` and `columnsBeforeHeaderGroupsDeps` hooks have been renamed to `flatColumns` and `flatColumnsDeps` respectively, which better reflects what they are used for, rather than their order, which can remain implicit.
- Added `headerGroups` and `headerGroupDeps` hooks, which, similar to `flatColumns`, allow you to decorate (and trigger) the memoized header group generation.
- Added `columns` and `columnsDeps` hooks, which, similar to `flatColumns` and `headerGroups`, allow you to decorate (and trigger) the memoized column generation/decoration.
- The new hook order is as follows: `columns/columnsDeps` => `flatColumns/flatColumnsDeps` => `headerGroups/headerGroupsDeps`
- `useColumnVisibility` now uses the new `headerGroupsDeps` hook to trigger header group regeneration when visibility changes
These definitions mask errors in the other definitions and there are better
ways of extending these.
See https://github.com/tannerlinsley/react-table/pull/1597 for an
example of an existing prototype that was missing but harder to find
because of these definitions.
It turns out that pulling the types directly from a package slightly
changes how visible they are to the consuming application. This makes
sense, previously we explicitly adding the react-table module to the
global namespace an so didn't need explicit imports, but now that's not
the case. So add explicit imports.
* ci: test cross platform
Test on Node.js 10 and 12, long term release support versions.
Test on Linux, Mac, and Windows machines.
* fix: update ic-ci-cli to version 2
includes fixes to support windows
* ci: disable yarn gpg
* ci: double quote string for windows ci
useTableState was an early and hasty abstraction that hasn't proved useful in many ways. Anything
you could do with useTableState, you could easily do using the same options (assuming they exist) in
the useTable hook. For this reason, state is now a first class citizen of the useTable hook, along
with more sane properties and option locations for anything pertaining to state.
Width options (`width`, `minWidth`, `maxWidth`) options are now a part of the core column object.
useBlockLayout and useAbsoluteLayout hooks now use this new internalized information to implement
their layouts. Those examples have been updated. A virtualized-rows example has also been added to
show off how the useBlockLayout hook can be used to virtualize rows with react-window.
* useAbsoluteLayout: To build tables with divs
* Adding `placeholderOf` attribute to column
* Adding `useAbsoluteLayout` in index.js
* Adding `useAbsoluteLayout` example
* Adding `useAbsoluteLayout` in api docs
* Adding test for `useAbsoluteLayout` hook
* TypeScript updates
I've found that trying to get solid TypeScript typings for this library
are a bit of a challenge. The composable nature of the library means
that the types for the builtin functions are by their nature somewhat
minimal, and that the user needs to be able to extend those interfaces
to reflect the specific plugins that are in use.
With that in mind I propose something like this.
To get the best out of them, you then need to extend those interfaces
using declaration merging, see
https://www.typescriptlang.org/docs/handbook/declaration-merging.html
e.g.
```ts
declare module 'react-table-hooks' {
export interface TableInstance<D = any>
extends UseFiltersValues<D>,
UsePaginationValues<D>,
UseExpandedValues,
UseGroupByValues {}
export interface TableState<D = any>
extends UsePaginationState,
UseGroupByState,
UseSortbyState<D>,
UseFiltersState<D> {}
}
```
This also puts the ability to extend those types with any user defined
hooks completely in the users hands.
This gives the greatest flexibility, but I'll admit that it isn't
particularly obvious. Perhaps a typescript readme and example is needed.
* fix useExpanded type
* fix module name
* fix typo
* address review feedback
* add IdType, update Filters definition
useExpanded now uses a flat array of row path keys for tracking expanded state instead of nested
objects. This is both easier to use as a developer, but also enables expanding all rows or even
leaving nested rows in an expanded state, despite their parent rows' expanded state.
BREAKING CHANGE: See description
* Sub rows are selected if the parent row is selected.
* Parent rows are updated accordingly if a subRow is selected.
* Updated useRowSelect snapshot tests to test subRow selection.
* fix(use-sort-by): sorting now ignores column ids that no longer exist
* fix(use-filters): filtering no longer fails when column doesn't exist
* fix(use-sortby): filtering out invalid sortBys before sorting
The renderer function for headers, columns, cells, aggregates, filters, etc used to mix properties
from all of those contexts, including rows. Now thow contexts are located on their own reserved
properties, eg. `Cell: ({ cell: { value}, row, column, ...instance }) => value`
BREAKING CHANGE: The renderer function for headers, columns, cells, aggregates, filters, etc used
in case of using construction like:
```
{
defaultColumn = {}
}
```
`defaultColumn` will get new instance each time, so as result it force to recalculation each of `React.useMemo`.
* [v7] useSort - Multisort functionality: Limit `multiSort` number and configurable shift key
1. Provide configuration for multisort that pressing shift key is not compulsory
2. Configurable limit on max number of columns for multisort, like configuration has been provided that `maxMultiSortColCount` is 3, suppose currenlty table is sorted by `[A, B, C]` and then clicking `D` for sorting should result in table sorted by `[B, C , D]`
* update readme for new multisort options
* Use `isMultiSortEvent` function
so as to make `shift` key optional or take decision based on other parameters for multisorting
* `isMultiSortEvent` updated readme
* chore(package.json): use latest babel core, remove bridge
* test(.babelrc): add test environment so that Jest can use ES6 imports
* test(usetable): fix import
Since useColumns was relying on groupBy logic, this was code smell. I wanted useGroupBy to be able to add that logic all by itself and not have to have dependencies in the core of the table.
To fix that, I've moved the core column and row logic to the useTable hook and added a new hook 'columnsBeforeHeaderGroups' to allow useGroupBy to do what i needs in a more pure way.
* added assertion to check for show property inside column
* reverted previous change
* added a filter to weed out non-visible columns when calculating the size for grouped Headers
* added another case to the previous filter to factor in blank grouped Headers
* Fix pagination resetting to page zero with manualPagination
To be honest I'm not sure what this useLayoutEffect is there to do.
It has no visible effect if you don't use manualPagination, and if you
do it, simply jumps you back to the first page, defeating the point of
you having control of the pagination.
* Conditionally reset page on data change
Rather disable the whole page reset when filters, groupBy or sortBy
change, just because I wanted to disable the page reset on data change,
make that bit be conditional.
With that in mind, usePagination now accepts a
disablePageResetOnDataChange parameter.
V7 adds the option to remove a sort option, so it goes from asc -> desc
-> unset, then repeats. V6 just went from asc -> desc then repeated.
Personally I much preferred this, I think that there's a case to be made
that this is the more expected behavior.
I'm not sure if this is really the best way to fix this since it adds
yet another api option and I completely understand that that is less
than desirable, but I also would rather add an option than have to
duplicate the whole useSortBy hook.
This change allows you to technically use React Table without a layout hook. Under that assumption, you would need to come up with your own styling mechanisms for display.
The useSimpleLayout merely adds a single `width` style to the prop getters for column headers and cells.
The useFlexLayout is much more robust. Personally though, I have moved away from both, and am just using raw `display: table-row/table-cell` styles to let my tables display naturally.
* Install useSimpleLayout and adjust useTable and useRows as required.
* useSimpleLayout integration
* Minor final fix - replace .filter with .forEach
* Used a spread on the path.
Pagination elements are now customizable without having
to create a new Pagination component, that would
mostly mimic the existing one in terms of functionality.
* Adds import instructions to the HOC README
Also fixes up some language and remove other import instructions. It's better to just have the import instructions in just one place.
* Better visualizes a list of functions
I found the added Props by looking into the defaultProps.js when I could not find a way change the styling of the filter row.
Custom Props
Built-in Components
Every single built-in component's props can be dynamically extended using any one of these prop-callbacks:
<ReactTable
getProps={fn}
getTableProps={fn}
getTheadGroupProps={fn}
getTheadGroupTrProps={fn}
getTheadGroupThProps={fn}
getTheadProps={fn}
getTheadTrProps={fn}
getTheadThProps={fn}
+getTheadFilterProps={fn}
+getTheadFilterTrProps={fn}
+getTheadFilterThProps={fn}
* Add aria-label attributes to pagination jump and row count selector with a new prop to specify different text.
* Add new text props for labels to README
When rendering a class component using the `class extends React.Component {}` syntax, you would get an error `TypeError: Cannot call a class as a function` because the check to determine whether a component was a class component was insufficient. It seems pointless to even have a check, however, because the JSX syntax can render both class and functional components.
* initial commit
* update readme
* update examples and src
* edit readme
* use single instance of advancedExpandTable
* add in hoc codesandbox to docs, run eslint on new source file
* Also check ID field when finding pivot col in treeTableHOC
* Pass the ID if you've got one on treeTableHOC
* An expandable cell should never be hidden
* Fix typo
* Edit link to working codesandbox
Fix '100k Rows w/ Pivoting & Sub Components' example
Closes#870
* Add cross-env to remove environment variable errors on Windows
I think this is the most common way of setting columns or expanderDefaults.
I had to find issue #565 and then follow it to issue #394 to see explanations on how to do this.
I have used this library to develop a big application for my company and had been required to make the columns are foldable. I saw that feature is useful and would like to share with everybody. Especially to all developers who developed this great component.
Let me know if any issues with My component. I will fix it accordingly.
* Merge fork from master (#6)
* Examples Refactor + multiSort flag (#619)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Docs testing cleanup (#645)
* Examples Refactor + multiSort flag (#619) (#4)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Examples Refactor + multiSort flag (#619) (#5)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Fork Update (#7)
* Examples Refactor + multiSort flag (#619)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Docs testing cleanup (#645)
* Examples Refactor + multiSort flag (#619) (#4)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Examples Refactor + multiSort flag (#619) (#5)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Update README.md (#584)
* Update README.md
Missing " on Features list,
Extra comma removed
* Update README.md
Added space for component uniformity.
* Update the devDependencies for the linter (#596)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix ThComponent classnames ordering (#673)
Allow for custom classname to overwrite base styles
* Add column to getResizerProps (#667)
* CHANGELOG update
* Doco updates
fixed a typo - ‘row’ to ‘original’
added minimal dock on ‘minRows’
* Merge from original (#9)
* Examples Refactor + multiSort flag (#619)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Docs testing cleanup (#645)
* Examples Refactor + multiSort flag (#619) (#4)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Examples Refactor + multiSort flag (#619) (#5)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Update README.md (#584)
* Update README.md
Missing " on Features list,
Extra comma removed
* Update README.md
Added space for component uniformity.
* Update the devDependencies for the linter (#596)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix ThComponent classnames ordering (#673)
Allow for custom classname to overwrite base styles
* Add column to getResizerProps (#667)
* CHANGELOG update for 6.7.5 (#679)
* Merge fork from master (#6)
* Examples Refactor + multiSort flag (#619)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Docs testing cleanup (#645)
* Examples Refactor + multiSort flag (#619) (#4)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Examples Refactor + multiSort flag (#619) (#5)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Fork Update (#7)
* Examples Refactor + multiSort flag (#619)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Docs testing cleanup (#645)
* Examples Refactor + multiSort flag (#619) (#4)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Examples Refactor + multiSort flag (#619) (#5)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Update README.md (#584)
* Update README.md
Missing " on Features list,
Extra comma removed
* Update README.md
Added space for component uniformity.
* Update the devDependencies for the linter (#596)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix ThComponent classnames ordering (#673)
Allow for custom classname to overwrite base styles
* Add column to getResizerProps (#667)
* CHANGELOG update
* Use preset-env instead of preset-es2015
Remove preset-stage-2 and use individual required plugins.
* Expose es module build
* Update scripts in package.json
* Use rollup for faster and lighter umd builds
Add non minified version of the build.
* Merge fork from master (#6)
* Examples Refactor + multiSort flag (#619)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Docs testing cleanup (#645)
* Examples Refactor + multiSort flag (#619) (#4)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Examples Refactor + multiSort flag (#619) (#5)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Fork Update (#7)
* Examples Refactor + multiSort flag (#619)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Docs testing cleanup (#645)
* Examples Refactor + multiSort flag (#619) (#4)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Examples Refactor + multiSort flag (#619) (#5)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Update README.md (#584)
* Update README.md
Missing " on Features list,
Extra comma removed
* Update README.md
Added space for component uniformity.
* Update the devDependencies for the linter (#596)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix ThComponent classnames ordering (#673)
Allow for custom classname to overwrite base styles
* Add column to getResizerProps (#667)
* CHANGELOG update
* Header focus bug fix
Fixes#685
* Merge fork from master (#6)
* Examples Refactor + multiSort flag (#619)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Docs testing cleanup (#645)
* Examples Refactor + multiSort flag (#619) (#4)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Examples Refactor + multiSort flag (#619) (#5)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Fork Update (#7)
* Examples Refactor + multiSort flag (#619)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Docs testing cleanup (#645)
* Examples Refactor + multiSort flag (#619) (#4)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Examples Refactor + multiSort flag (#619) (#5)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Update README.md (#584)
* Update README.md
Missing " on Features list,
Extra comma removed
* Update README.md
Added space for component uniformity.
* Update the devDependencies for the linter (#596)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix ThComponent classnames ordering (#673)
Allow for custom classname to overwrite base styles
* Add column to getResizerProps (#667)
* CHANGELOG update
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Examples Refactor + multiSort flag (#619) (#4)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* Examples Refactor + multiSort flag (#619) (#5)
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
Still requires some basic sanity test to ensure ReactTable does
not have any fundamental coding errors.
Modified some of the /docs code to help with manual testing.
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
* Refactor HOCs to /src/hoc
Still have to write the HOCReadme.md (still just a placeholder for now)
* Refactor complete
May need to remove some redundant code
* Text change for the HOC samples
* Introduced a 'multiSort' flag
Defaults to 'true'
A 'false' value will turn multi-sort off.
* refactor: Fix defaultProps.js linter errors
* refactor: Fix lifecycle.js linter errors
* refactor: Fix pagination.js linter errors
* refactor: Fix propTypes.js linter errors
* refactor: Fix utils.js linter errors
* refactor: Fix methods.js linter errors
* refactor: Fix index.js linter errors
* Fix for linter changes + CHANGELOG update
* chore: Update the devDependencies for the linter
* A few HOC examples for react-table.
Not really integrated with the whole codesandbox.io approach.
* Missing dependency - shortid
We have found that with longer documentation files, the position of the sponsor link is more effective in helping fund the project when it's higher in the readme.
The current css selectors, eg. `.ReactTable input` cause conflicts with `input` elements inside Cells. So changed it to `.ReactTable .-pagination input`.
This brings `rt-tfoot` into line with `rt-thead` in terms of flex behaviour.
Without this, it's possible for an `rt-tr` to be taller than its containing
`rt-tfoot` without causing it to expand, which causes the outer `rt-table` to
scroll vertically.
* Add column id to the rowInfo object (passed to render). Resolves#237
* Creating a new object instead of modifying existing rowInfo; Refs #253
* Code style compliance. Refs #253
* Prevent transitions while resizing for a smoother effect.
* Disable text selection when resizing columns
* Use PivotValueComponent instead of pivotRender
* Add changelog file
* Convert expander column to be more like a regular column.
* Update story.
* Simplify setting render on defaultExpander.
* Add more control over expander and pivot columns using the column.
* Fix default filtering on pivot column.
* Add comments.
* Add column resizing for non pivot columns.
* Fixing resizing UI issues and mobile functionality.
* Remove calling onChange during resize events so that server example doesn't refetch data every time a column resizes.
* Change precedence in 'getResolvedState'
* Previously existing props would overwrite passed in state
* Now passed in state gets precedence
* added a controlled table example to storybook
* Add column filtering.
* Fix javascript warning from yarn test. Compile storybook and docs.
* Pass standard linting
* Add support for filtering pivot columns.
* Build distribution files.
* Set page to max page available if data changes and has less pages than before.
Closes#159
* Add column filtering.
* Fix javascript warning from yarn test. Compile storybook and docs.
* Pass standard linting
* Add support for filtering pivot columns.
* Build distribution files.
* Rename CollapseOnPageChange to CollapseOnDataChange to more accurately reflect its purpose.
* Add support for collapseOnPageChange.
* Fix collapseOnPageChange efficiency.
* rough draft of "closeSubComponentOnDataChange" and "preventAutoSortWhenComponentIsOpen"
* changed flag name from ...component to ...subcomponent
* fixed problem with sorting not immediately being applied. passes tests now
* changed var names
* Cleanup and simplification
* Fix deps
* Better freezing strategy
* subcomponent reverse
2017-02-06 15:09:35 -07:00
647 changed files with 357871 additions and 8390 deletions
We do not track feature requests through Github. Please use [Github Discussions](https://github.com/tannerlinsley/react-table/discussions) to talk about new ideas and features.
We do not use Github to track general support. Please use our public support forum at https://github.com/tannerlinsley/react-table/discussions.
NOTE: If a support/help/question issue is opened, it will be closed immediately and be redirected to the forum. Thanks for helping us keep our issues clean and productive!
- Added the `value` property to cell renderers so that destructurin the value from the `cell` property is now not necessary. This should help with people migrating from v6 and also just to cut down on noise in cell renderers
- Fixed an issue where rollup would not build correctly
- Fixed an issue where a page index of `-1` would result in an error
## 7.0.0 🎉
- Fixed an issue where page options array could be empty
- Fixed an issue where duplicate columns would be silently deduped. There is now a warning when duplicate columns are found based on their IDs
- Moved some functions around so they will get treeshaked with their respective plugins that use them.
- Fixed an issue where filters, sorting, or grouping changes would not reset pagination
- Added table and column level options for disabling global filters
- Fixed an issue where row selection was not deselecting rows
- Fixed an issue where flex table rendering was not giving the table a minimum width with necessary
- Fixed an issue where row selection would not work when using other row-transformative plugins like filters or grouping
- Fixed an issue where header groups were not memoized correctly
## 7.0.0-rc.16
- Moved away from snapshot tests. No more testing implementation details.
- Added `visibleColumns` and `visibleColumnsDeps` hooks to manipulate columns after all data is processed. Further visibility processing may result in these columns not being visible, such as `hiddenColumn` state
- The `useRows` hook has been deprecated due to its dangerous nature 💀
- Added the `instance.rowsById` object
- Renamed `instance.flatColumns` to `instance.allColumns` which now accumulates ALL columns created for the table, visible or not.
- Added the `instance.visibleColumns` object
- Fix an issue where `useAsyncDebounce` would crash when passed arguments
- Started development on the `usePivotColumns` plugin, which can be tested currently using the `_UNSTABLE_usePivotColumns` export.
- Renamed `cell.isRepeatedValue` to `cell.isPlaceholder`
- Removed `useConsumeHookGetter` as it was inefficient most of the time and noisy
- All hooks are now "consumed" right after main plugin functions are run. This means that any attempt to add a plugin after that will result in a runtime error (for good reason, since using hook points should not be a conditional or async operation)
- Added `instance.getHooks` for getting the list of hooks that was captured after plugins are run
- Normalized all "toggle" actions to use an optional `value` property to set the value instead of toggle. Previously properties like `selected`, `groupBy`, etc. were used, but not any more!
- Undocument `instance.dispatch`. Both plugins and users should be interacting with the table via methods assigned to the instance and other structures on the table. This should both reduce the surface API that React Table needs to expose and also the amount of documentation that is needed to understand how to use the API.
-`useRowState`'s `initialRowStateAccessor` and `initialCellStateAccessor` options now have a default of `row => ({})` and `cell => ({})` respectively.
- Removed the concept of complex aggregations (eg. `column.aggregate = ['sum', 'count']`). Instead, a better aggregation function signature is now used to allow for leaf node aggregation when needed.
- Added the `column.aggregateValue` option which allows resolving (or pre-aggregating) a cell's value before it is grouped and aggregated across rows. This is useful for cell values that are not primitive, eg. an array of values that you may want to unique and count before summing that count across your groupings
- The function signature for aggregation functions has changed to be `(leafValues, aggregatedValues) => aggregatedValue` where `leafValues` is a flat array containing all leaf rows currently grouped at the aggregation level and `aggregatedValues` is an array containing the aggregated values from the immediate child sub rows. Each has purpose in the types of aggregations they power where optimizations are made for either accuracy or performance.
- Fixed an issue where `setGlobalFilter` was not a stable callback
- Added a Bootstrap UI example
- Added fixed with column support for useFlexLayout
- Fixed an issue where `manualGlobalFilter` was not resetting pagination properly
- Fixed an issue where `useGlobalFilter` could be placed after `usePagination`
- Added the sort order direction as a parameter to the sortMethod function
- Fixed an issue where user filter types were not being referenced correctly
- Renamed the `row.getExpandedToggleProps` to `row.getToggleRowExpandedProps`
- Renamed the `row.toggleExpanded` method to `row.toggleRowExpanded`
- Added the `instance.toggleRowExpanded` and `instance.toggleAllRowsExpanded` methods
- Added the `instance.getToggleAllRowsExpandedProps` prop getter
- Added the `instance.filteredRowsById` property
- Added the `instance.preFilteredRowsById` property
- useFilters now properly updates the `instance.rowsById` property
- Added the `instance.globalFilteredRowsById` property
- Added the `instance.preGlobalFilteredRowsById` property
- useGlobalFilter now properly updates the `instance.rowsById` property
- Added the `instance.nonGroupedFlatRows` property
- Added the `instance.nonGroupedRowsById` property
- Added the `instance.onlyGroupedFlatRows` property
- Added the `instance.onlyGroupedRowsById` property
- Improved the api around ensuring plugin ordering
- Added more plugin order rules to avoid strange plugin integration results
## 7.0.0-rc.15
- Added `useGlobalFilter` hook for performing table-wide filtering
- Filter function signature has changed to supply an array of column IDs (to support both the tranditional single column style and the new multi-column search style introduced with `useGlobalFilter`).
- Removed the `column` parameter from the filter function signature as it was unused and no longer made sense with the array of IDs change above.
- Updated the `filtering` example to use a global filter in addition to the column filters
## 7.0.0-rc.14
- Changed the function signature for all propGetter hooks to accept a single object of named meta properties instead of a variable length of meta arguments. The user props object has also been added as a property to all prop getters. For example, `hooks.getRowProps.push((props, instance, row) => [...])` is now written `hooks.getRowProps.push((props, { instance, row, userProps }) => [...])`
- Changed the function signature for all reduceHooks accept a single object of named meta properties instead of a variable length of meta arguments. For example, `hooks.flatColumns.push((flatColumns, instance) => flatColumns)` is now written `hooks.flatColumns.push((flatColumns, { instance }) => flatColumns)`
- Changed the function signature for all loopHooks accept a single object of named meta properties instead of a variable length of meta arguments. For example, `hooks.prepareRow.push((row, instance) => void)` is now written `hooks.prepareRow.push((row, { instance }) => void)`
## 7.0.0-rc.13
- Added the `useControlledState` hook for plugins to manipulate the final state of the table similar to how users can
- Fixed an issue where column hiding wasn't working properly.
## 7.0.0-rc.12
- Fixed an issue where removing a grouped column would result in a crash
## 7.0.0-rc.11
- Fixed an issue where plugins using the `columns` hook were not getting decorated properly
- Added back a new rendition of the `useFlexLayout` plugin and accompanying example.
- Fixed all reset actions to use the initial state passed into the table, then fall back to the default initial state for the hook
## 7.0.0-rc.10
- Optimizations made to make accessors, prop getters and other internals much faster. 10x in some cases!
- Fixed docs for `usePagination` to have `pageIndex` and `pageSize` only available on the state object, not the instance
- Added a plugin order restriction to make sure `useResizeColumns` always comes before `useAbsoluteLayout`
- Fixed the `useFinalInstance` hook to not have an empty array as the first meta argument passed.
- Fixed an issue where memoized or ref-forwarded components could not be used as cell renderers
- The `toggleExpandedById` action has been renamed to `toggleExpanded`
- Added the `toggleAllExpanded` action
- Added the `setExpanded` action
- Changed `row.isAggregated` to `row.isGrouped`
-`state.expanded` and `state.selectedRowIds` are now objects (`{[rowId]: Bool}`), not arrays. This should help with mid-to-large size datasets while also being serializable (instead of a Set(), which is not as reliable)
-`state.filters` is now an array of objects (`{id, value}`). Since filters do have order and can be applied incrementally, it should be an array to ensure correct order.
- Moved the `flatColumns` and `flatColumnsDeps` hooks to be after row/data materialization. These hooks can then manipulate the `flatColumns` object after all data has been accessed without triggering row materialization again.
- Added the `row.allCells` property and the `cellColumns` reducer hook to determine which cells to create for each row. These cells are placed into `row.allCells`. The resulting cell array is not meant to be used for display in templating and is only made available for convenience and/or advanced templating.
- Added the `cells` reducer hook to determine which cells from the `row.allCells` array that should be placed into `row.cells`. The resulting cell array is the one that is intended for display in templating.
- Reducers are now passed the actual instance variable, not the instanceRef
- Added the `makeRenderer` utility (also exported)
- Removed `column.groupByBoundary` functionality. If needed, use the `flatColumns` hook to decorate, reorganize or re-order groupBy columns
- Fixed grouped row.id's to be truly unique
## 7.0.0-rc.9
- Fixed an issue where dependency hooks were not being reduced properly, thus the table would rerender unnecessarily
- Renamed `toggleRowSelectedAll` to `toggleAllRowsSelected`. Duh...
- Added an `indeterminate` boolean prop to the default props for row selection toggle prop getters
- Renamed `selectedRowPaths` to `selectedRowIds`, which also no longer contains paths, but row IDs
- Grouped or nested row selection actions and state are now derived, instead of tracked in state.
- Rows now have a new property called `id`, which existed before and was derived from the `getRowId` option
- Rows now also have an `isSomeSelected` prop when using the `useRowSelect` hook, which denotes that at least one subRow is selected (if applicable)
- Rows' `path` property has been deprecated in favor of `id`
- Expanded state is now tracked with row IDs instead of paths
- RowState is now tracked with row IDs instead of paths
-`toggleExpandedByPath` has been renamed to `toggleExpandedById`, and thus accepts a row ID now, instead of a row path
## 7.0.0-rc.8
- Fix an issue where `useResizeColumns` would crash when using the resizer prop getter
- Fix an issue where `useBlockLayout` was clobbering props sent to headers
## 7.0.0-rc.7
Removed:
-`applyHooks` (exported but undocumented) function has been deprecated. Please use either `reduceHooks` or `loopHooks` utilities in your custom plugins now.
-`applyPropHooks` (exported but undocumented) function has been deprecated. Please use the `makePropGetter` utility in your custom plugins now.
Added:
-`reduceHooks` exported utility which is used to reduce a value through a collection of hooks. Each hook must return a value (mutation is discouraged)
-`loopHooks` exported utility which is used to loop over a collection of hooks. Hooks are not allowed to return a value (mutation is encouraged)
-`makePropGetter` exported utility which is used to create prop getters from a prop getter hook.
-`useOptions` plugin hook, which allows a plugin to reduce/modify the initial options being passed to the table
-`useFinalInstance` plugin hook, which allows a plugin access to the final table instance before it is returned to the user.
Modified:
- Prop-getter hook functions now support returning an array (in addition to the typical object of props). When an array is returned, each item in the array is smart-merged into a new props object (meaning it will intelligently compose and override styles and className)
- Prop-getter function supplied to the table have 2 new overloaded options (in addition to the typical object of props):
-`Function(props, instance, ...row/col/context) => Array<props> | props` - If a function is passed to a prop getter function, it will receive the previous props, the table instance, and potentially more context arguments. It is then be expected to return either an array of new props (to be smart-merged with styles and classes, the latest values taking priority over the previous values) or a props object (which will replace all previous props)
-`Array<props>` - If an array is passed to a prop getter function, each prop object in the array will be smart-merged with styles and classes into the props from previous hooks (with the latest values taking priority over the previous values).
- Extracted default hooks into separate file.
- Converted almost all usages of `instanceRef.current` to use `useGetLatest(instanceRef.current)` to help with avoiding memory leaks and to be more terse.
- Converted all previous prop-getter definitions to use the new `makePropGetter`
- Reorganized plugin hooks to declare as many hooks in the main plugin function as opposed to in the `useInstance` hook.
- Changed the `useInstanceBeforeDimensions` hook to be a `loopHooks` call instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to encourage mutation of the instance)
- Changed the `useInstance` hook to be a `loopHooks` call instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to encourage mutation of the instance)
- Change the `prepareRow` hook to be a `loopHooks` call instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to encourage mutation of the row)
## 7.0.0-rc.6
- The `columnsBeforeHeaderGroups` and `columnsBeforeHeaderGroupsDeps` hooks have been renamed to `flatColumns` and `flatColumnsDeps` respectively, which better reflects what they are used for, rather than their order, which can remain implicit.
- Added `headerGroups` and `headerGroupDeps` hooks, which, similar to `flatColumns`, allow you to decorate (and trigger) the memoized header group generation.
- Added `columns` and `columnsDeps` hooks, which, similar to `flatColumns` and `headerGroups`, allow you to decorate (and trigger) the memoized column generation/decoration.
- The new hook order is as follows: `columns/columnsDeps` => `flatColumns/flatColumnsDeps` => `headerGroups/headerGroupsDeps`
-`useColumnVisibility` now uses the new `headerGroupsDeps` hook to trigger header group regeneration when visibility changes
## 7.0.0-rc.5
- Fixed an issue where the exported `useAsyncDebounce` method would crash if its promise throw an error.
## 7.0.0-rc.4
- A maintenance release, purely intended to update the @latest tag (which was overwritten by a v6 publish)
## 7.0.0-rc.3
- Fixed an issue where `column.clearSortBy` would crash
## 7.0.0-rc.2
-`reducerHandlers` has been deprecated in favor of the new `stateReducers` hook.
- The `previousState` and `instanceRef` are now both generally available in state reducers for convenience.
- The global action property `action.instanceRef` has been deprecated.
- The `reducer` option has been renamed to `stateReducer` and in addition to passing a single reducer function now also supports passing an array of reducers
- Renamed `manualSorting` to be `manualSortBy` to be consistent with other naming conventions
- Removed the `getResetPageDeps` option in favor of the new `autoResetPage` option.
- Removed the `getResetFilterDeps` option in favor of the new `autoResetFilters` option.
- Removed the `getResetSortByDeps` option in favor of the new `autoResetSortBy` option.
- Removed the `getResetGroupByDeps` option in favor of the new `autoResetGroupBy` option.
- Removed the `getResetExpandedDeps` option in favor of the new `autoResetExpanded` option.
- Added a new exported utility called `useAsyncDebounce` to aid with external async side-effects.
- A new `useGetLatest` hook is used internally to track latest instances in a less ref-driven and verbose way.
- A new `useMountedLayoutEffect` hooks is now used internally to handle post-mount side-effects, mostly dealing with autoReset functionality
- Plugin hooks are now "consumed" using an internal `useConsumeHookGetter` hook. When they are consumed, they can no longer be manipulated past that point in the table lifecycle. This should help ensure people are using them in a relatively safe order with consistent expectations.
- Drastically "reduced" the reducer logic itself to be easier to understand and to be a stable reference for the life of the table. This change also means that the reducer must no longer be double-run/back-compared by React for changes in closure, thus actions and stateReducers (including user state reducers) will only fire once per action.
- Removed `debug` and related logging. It has been somewhat useful during development, but is now very noisy in the code. We can debug lifecycle and performance as needed from here on out.
- Removed unnecessary exports from `./utils.js` and moved all intentionally exported utilities to a new `./publicUtils.js` file.
## 7.0.0-rc.1
- Minor regex optimizations during row path creation
## 7.0.0-rc.0
- Added the support for the `Footer` renderer, `column.getFooterProps`, `footerGroups` and `footerGroup.getFooterProps`
## 7.0.0-beta.28
- Added the `useColumnVisibility` plugin as a core plugin along with several new instance and column-level methods to control column visibility
- Added the "column-hiding" example
## 7.0.0-beta.27
- Added the `useControlledState` option, which allows for hook-context control of the resolved internal table state
## 7.0.0-beta.26
- Fixed an issue where the table would crash if useSortBy was reset via the resetSortBy action
- Updated all of the examples to use the "react-table@latest" tag.
-`utils` is no longer an exported variable and instead, all of the individual util methods are exported at the root level of the library.
## 7.0.0-beta.25
- Fixed an issue where `useRowState` would crash due to invalid initial state of previous cell state on `columnId` lookup
## 7.0.0-beta.24
- Changed `selectedRowIds` to use a `Set()` instead of an array for performance.
- Removed types and related files from the repo. The community will now maintain types externally on Definitely Typed
## 7.0.0-beta.23
- The internal `useMain` hook has been renamed to `useInstance`
- The internal `useBeforeDimensions` hook has been renamed to `useInstanceBeforeDimensions`
- Fixed an issue where `useResizeColumns` wasn't working properly
## 7.0.0-beta.22
- Fixed an issue where `useRowState` would crash due to invalid initial state attempting to spread into the new state
## 7.0.0-beta.21
- Removed deprecated `defaultState` export
## 7.0.0-beta.20
- Internals have been reworked to use `useReducer` instead of `useState` for stability and architecture
- The `state` option has been removed in favor of using a custom reducer
- The `reducer` option has been changed to a new function signature: `function (newState, action, oldState) => newState`
- The `setState` table instance method is no longer supported
- The `dispatch` table instanced method was added
- The `ReactTable.actions` export is now a plain object of action types mapped to identically named action strings
- The `ReactTable.reducerHandlers` export was added, which is a plain object of plugin hook names mapped to their respective reducer functions
## 7.0.0-beta.19
- Added an `isAggregated` boolean parameter to the `aggregate` function signature
## 7.0.0-beta.16
- Removed service workers from examples
- Fixed a memory leak when `instance` was referenced in function closures
- Fixed an issue where the table would infinitely rerender due to incorrect effect dependencies
- Fixed an issue where row grouping and row selection would not work properly together.
## 7.0.0-beta.15
- Fixed an issue where `defaultGetResetPageDeps` was using `data` instead of `rows`
## 7.0.0-beta.14
- Removed
-`disablePageResetOnDataChange` option. use the `getResetPageDeps` option now.
- Added
-`getResetPageDeps` option
-`getResetFilterDeps` option
-`getResetSortByDeps` option
-`getResetGroupByDeps` option
-`getResetExpandedDeps` option
## 7.0.0-beta.13
- Added options
-`defaultCanSort`
-`defaultCanFilter`
-`defaultCanGroupBy`
-`column.defaultCanSort`
-`column.defaultCanFilter`
-`column.defaultCanGroupBy`
- Renamed
-`disableGrouping` to `disableGroupBy`
-`disableSorting` to `disableSortBy`
-`disableGroupBy` to `disableGroupBy`
-`column.disableGrouping` to `column.disableGroupBy`
-`column.disableSorting` to `column.disableSortBy`
-`column.disableGroupBy` to `column.disableGroupBy`
- Removed propType definitions. Since types are now being maintained, it makes little sense to also maintain these. Cooincidentally, this also saves some bundle size in some scenarios where they may not be removed properly by a developer's bundler.
## 7.0.0-beta.0
- Massive changes to the entire project and library. Please consult the README and documentation for more information regarding these changes.
## 6.8.6
#### Fixes & Optimizations
- Since `resolveData` is now capable of materializing data on it's own, the `data` prop is no longer required as a prop-type.
## 6.8.4
#### Fixes & Optimizations
- Only run `resolveData` prop when `data` prop has changed, not any others.
## 6.8.3
#### Fixes & Optimizations
- Allow the `resolveData` prop to alter or materialize new data when the `data` prop changes.
## 6.8.1
#### Fixes & Optimizations
- Updated eslint and code formatting
## 6.7.5
#### Fixes & Optimizations
- Now passes `column` to `getResizerProps` (#667)
- NOTE: `getResizerProps` is now only called if the column is resizable
- Fixes the `className` ordering in defaultProps for ThComponent (#673)
- NOTE: user supplied classNames now come at the end so they can extend the defaults
## 6.7.4
#### Fixes & Optimizations
- Fix Prop types for columns
## 6.7.3
#### Fixes & Optimizations
- Fix the rest of the proptypes
## 6.7.2
#### Fixes & Optimizations
-`getPropTypes` proptype check
## 6.7.1
#### Fixes & Optimizations
-`eslint-config` moved to dev deps
## 6.7.0
## 6.7.0-alpha-0
#### New Features
- Expose page/pageSize to rows/cells
- Supply sort direction to custom sort methods
#### Fixes & Optimizations
- README updates
- Linter cleanup
- Added PropTypes node module
- Deps, linting and style upgrades
## 6.6.0
#### Fixes & Optimizations
- moved repo to react-tools
- Doc examples moved to codesandbox.io
- README updates
- CSS refacting for rt-tfoot to match rt-thead
- CSS more specific for input and select
## 6.5.3
#### Fixes & Optimizations
-`onClick` proxying and eslint
## 6.5.2
#### New Features
- Provide onClick handleOriginal function - #406
#### Fixes & Optimizations
- README updates
-`makePathArray` in utils - #326
- Various fixes: #294, #376, #398, #415,
## 6.5.1
#### Fixes & Optimizations
-`defaultExpanded` now works correctly - #372
-`column.getProps().rest` props are now applied correctly
-`makeTemplateComponent` now supports `displayName` - #289
## 6.5.0
##### New Features
-`column.filterAll` - defaults to `false`, but when set to `true` will provide the entire array of rows to `filterMethod` as opposed to one row at a time. This allows for more fine-grained filtering using any method you can dream up. See the [Custom Filtering example](https://react-table.js.org/#/story/custom-filtering) for more info.
## 6.4.0
##### New Features
-`PadRowComponent` - the content rendered inside of a padding row. Defaults to a react component that renders ` `
## 6.3.0
##### New Features
-`defaultSortDesc` - allows you to set the default sorting direction for all columns to descending.
-`column.defaultSortDesc` - allows you to set the default sorting direction for a specific column. Falls back to the global `defaultSortDesc` when not set at all.
## 6.0.0
##### New Features
- New Renderers:
-`Aggregated` - Custom renderer for aggregated cells
-`Pivot` - Custom renderer for Pivoted Cells (utilizes `Expander` and `PivotValue`)
-`PivotValue` - Custom renderer for Pivot cell values (deprecates the undocumented `pivotRender` option)
-`Expander` - Custom renderer for Pivot cell Expander
- Added custom sorting methods per table via `defaultSortMethod` and per column via `column.sortMethod`
- Pivot columns are now visibly separate and sorted/filtered independently.
- Added `column.resizable` to override global table `resizable` option for specific columns.
- Added `column.sortable` to override global table `sortable` option for specific columns.
- Added `column.filterable` to override global table `filterable` option for specific columns.
- Added `defaultExpanded` table option.
- All callbacks can now be utilized without needing to hoist and manage the piece of state they export. That is what their prop counterparts are for, so now the corresponding prop is used instead of the callback to detect a "fully controlled" state.
- Prevent transitions while column resizing for a smoother resize effect.
- Disable text selection while resizing columns.
##### Breaking API Changes
- New Renderers:
-`Cell` - deprecates and replaces `render`
-`Header` - deprecates and replaces `header`
-`Footer` - deprecates and replaces `footer`
-`Filter`- deprecates and replaces `filterRender`
- Callbacks now provide the destination state as the primary parameter(s). This makes hoisting and controlling the state in redux or component state much easier. eg.
-`onSorting` no longer requires you to build your own toggle logic
-`onResize` no longer requires you to build your own resize logic
- Renamed `onChange` callback -> `onFetchData` which will always fire when a new data model needs to be fetched (or if not using `manual`, when new data is materialized internally).
- Renamed `hideFilter` -> `filterable` (Column option. Note the true/false value is now flipped.)
-`cellInfo.row` and `rowInfo.row` now reference the materialize data for the table. To reference the original row, use `cellInfo.original` and `rowInfo.original`
- Removed `pivotRender` column option. You can now control how the value is displayed by overriding the `PivotValueComponent` or the individual column's `PivotValue` renderer. See [Pivoting Options Story](https://react-table.js.org/?selectedKind=2.%20Demos&selectedStory=Pivoting%20Options&full=0&down=1&left=1&panelRight=0&downPanel=kadirahq%2Fstorybook-addon-actions%2Factions-panel) for a reference on how to customize pivot column rendering.
If you have questions about implementation details, help or support, then please use our dedicated community forum at [Github Discussions](https://github.com/tannerlinsley/react-table/discussions) **PLEASE NOTE:** If you choose to instead open an issue for your question, your issue will be immediately closed and redirected to the forum.
## Reporting Issues
If you have found what you think is a bug, please [file an issue](https://github.com/tannerlinsley/react-table/issues/new). **PLEASE NOTE:** Issues that are identified as implementation questions or non-issues will be immediately closed and redirected to [Github Discussions](https://github.com/tannerlinsley/react-table/discussions)
## Suggesting new features
If you are here to suggest a feature, first create an issue if it does not already exist. From there, we will discuss use-cases for the feature and then finally discuss how it could be implemented.
## Development
If you have been assigned to fix an issue or develop a new feature, please follow these steps to get started:
- Fork this repository
- Install dependencies by running `$ yarn`
- Link `react-table` locally by running `$ yarn link`
- Auto-build files as you edit by running `$ yarn start`
- Implement your changes and tests to files in the `src/` directory and corresponding test files
- To run examples, follow their individual directions. Usually this is just `$ yarn && yarn start`.
- To run examples using your local build, link to the local `react-table` by running `$ yarn link react-table` from the example's directory
- Document your changes in the appropriate doc page
Enjoy this library? Try them all! [React Query](https://github.com/tannerlinsley/react-query), [React Form](https://github.com/tannerlinsley/react-form), [React Charts](https://github.com/tannerlinsley/react-charts)
### [Become a Sponsor](https://github.com/sponsors/tannerlinsley/)
## Features
- Lightweight at 7kb (and just 2kb more for styles)
-Fully customizable JSX templating
-Supports both Client-side & Server-side pagination and multi-sorting
-Column Pivoting & Aggregation
-Minimal design & easily themeable
-Fully controllable via optional props and callbacks
-<a href="https://medium.com/@tannerlinsley/why-i-wrote-react-table-and-the-problems-it-has-solved-for-nozzle-others-445c4e93d4a8#.axza4ixba" target="\_parent">"Why I wrote React Table and the problems it has solved for Nozzle.io</a> by Tanner Linsley
Simply pass the `data` prop anything that resembles an array or object. Client-side sorting and pagination are built in, and your table will update gracefully as you change any props. [Server-side data](#server-side-data) is also supported!
## Props
These are all of the available props (and their default values) for the main `<ReactTable />` component.
```javascript
{
// General
data:[],
loading:false,
showPagination:true,
showPageSizeOptions:true,
pageSizeOptions:[5,10,20,25,50,100],
defaultPageSize:20,
showPageJump:true,
expanderColumnWidth:35,
// Controlled State Overrides (see Fully Controlled Component section)
page:undefined,
pageSize:undefined,
sorting:undefined
// Controlled State Callbacks
onExpandSubComponent:undefined,
onPageChange:undefined,
onPageSizeChange:undefined,
onSortingChange:undefined,
// Pivoting
pivotBy:undefined,
pivotColumnWidth:200,
pivotValKey:'_pivotVal',
pivotIDKey:'_pivotID',
subRowsKey:'_subRows',
// Pivoting State Overrides (see Fully Controlled Component section)
expandedRows:{},
// Pivoting State Callbacks
onExpandRow:undefined,
// General Callbacks
onChange:()=>null,
// Classes
className:'',
style:{},
// Component decorators
getProps:()=>({}),
getTableProps:()=>({}),
getTheadGroupProps:()=>({}),
getTheadGroupTrProps:()=>({}),
getTheadGroupThProps:()=>({}),
getTheadProps:()=>({}),
getTheadTrProps:()=>({}),
getTheadThProps:()=>({}),
getTbodyProps:()=>({}),
getTrGroupProps:()=>({}),
getTrProps:()=>({}),
getThProps:()=>({}),
getTdProps:()=>({}),
getPaginationProps:()=>({}),
getLoadingProps:()=>({}),
// Global Column Defaults
column:{
sortable:true,
show:true,
minWidth:100,
// Cells only
render:undefined,
className:'',
style:{},
getProps:()=>({}),
// Headers only
header:undefined,
headerClassName:'',
headerStyle:{},
getHeaderProps:()=>({})
},
// Text
previousText:'Previous',
nextText:'Next',
loadingText:'Loading...',
pageText:'Page',
ofText:'of',
rowsText:'rows',
}
```
You can easily override the core defaults like so:
```javascript
import{ReactTableDefaults}from'react-table'
Object.assign(ReactTableDefaults,{
defaultPageSize:10,
minRows:3,
// etc...
})
```
Or just define them as props
```javascript
<ReactTable
defaultPageSize={10}
minRows={3}
// etc...
/>
```
## Columns
`<ReactTable/>` requires a `columns` prop, which is an array of objects containing the following properties
id:'myProperty',// Conditional - A unique ID is required if the accessor is not a string or if you would like to override the column name used in server-side calls
sortable:true,
sort:'asc'or'desc',// used to determine the column sorting on init
show:true,// can be used to hide a column
width:undefined,// A hardcoded width for the column. This overrides both min and max width options
minWidth:100// A minimum width for this column. If there is extra room, column will flex to fill available space (up to the max-width, if set)
maxWidth:undefined// A maximum width for this column.
// Special
expander:false// This option will override all data-related options and designates the column to be used
// for pivoting and sub-component expansion
// Cell Options
className:'',// Set the classname of the `td` element of the column
style:{},// Set the style of the `td` element of the column
render:JSXeg.(rowInfo:{value,rowValues,row,index,viewIndex})=><span>{value}</span>, //ProvideaJSXelementorstatelessfunctiontorenderwhateveryouwantasthecolumn's cell with access to the entire row
// value == the accessed value of the column
// rowValues == an object of all of the accessed values for the row
// row == the original row of data supplied to the table
// index == the original index of the data supplied to the table
// viewIndex == the index of the row in the current page
// Header & HeaderGroup Options
header: 'HeaderName' or JSX eg. ({data, column}) => <div>Header Name</div>,
headerClassName: '',// Set the classname of the `th` element of the column
headerStyle:{},// Set the style of the `th` element of the column
// Header Groups only
columns:[...]// See Header Groups section below
}]
```
## Column Header Groups
To group columns with another header column, just nest your columns in a header column. Header columns utilize the same header properties as regular columns.
React-table ships with a minimal and clean stylesheet to get you on your feet quickly. It's located at `react-table/react-table.css`.
#### Built-in Styles
- Adding a `-striped` className to ReactTable will slightly color odd numbered rows for legibility
- Adding a `-highlight` className to ReactTable will highlight any row as you hover over it
#### CSS Styles
We think the default styles looks great! But, if you prefer a more custom look, all of the included styles are easily overridable. Every single component contains a unique class that makes it super easy to customize. Just go for it!
#### JS Styles
Every single react-table element and `get[ComponentName]Props` callback support classes (powered by `classname` and js styles.
## Custom Props
#### Built-in Components
Every single built-in component's props can be dynamically extended using any one of these prop-callbacks:
```javascript
<ReactTable
getProps={fn}
getTableProps={fn}
getTheadGroupProps={fn}
getTheadGroupTrProps={fn}
getTheadGroupThProps={fn}
getTheadProps={fn}
getTheadTrProps={fn}
getTheadThProps={fn}
getTbodyProps={fn}
getTrGroupProps={fn}
getTrProps={fn}
getThProps={fn}
getTdProps={fn}
getPaginationProps={fn}
getLoadingProps={fn}
/>
```
These callbacks are executed with each render of the element with three parameters:
1. Table State
1. RowInfo (undefined if not applicable)
1. Column (undefined if not applicable)
1. React Table Instance
This makes it extremely easy to add, say... a row click callback!
```javascript
// When any Td element is clicked, we'll log out some information
<ReactTable
getTdProps={(state,rowInfo,column,instance)=>{
return{
onClick:e=>{
console.log('A Td Element was clicked!')
console.log('it produced this event:',e)
console.log('It was in this column:',column)
console.log('It was in this row:',rowInfo)
console.log('It was in this table instance:',instance)
}
}
}}
/>
```
You can use these callbacks for dynamic styling as well!
```javascript
// Any Tr element will be green if its (row.age > 20)
<ReactTable
getTrProps={(state,rowInfo,column)=>{
return{
style:{
background:rowInfo.age>20?'green':'red'
}
}
}}
/>
```
#### Column Components
Just as core components can have dynamic props, columns and column headers can too!
You can utilize either of these prop callbacks on columns:
```javascript
constcolumns=[{
getHeaderProps:()=>(...),
getProps:()=>(...)
}]
```
In a similar fashion these can be used to dynamically style just about anything!
```javascript
// This columns cells will be red if (row.name === Santa Clause)
Pivoting the table will group records together based on their accessed values and allow the rows in that group to be expanded underneath it.
To pivot, pass an array of `columnID`'s to `pivotBy`. Remember, a column's `id` is either the one that you assign it (when using a custom accessors) or its `accessor` string.
```javascript
<ReactTable
...
pivotBy={['lastName','age']}
/>
```
Naturally when grouping rows together, you may want to aggregate the rows inside it into the grouped column. No aggregation is done by default, however, it is very simple to aggregate any pivoted columns:
```javascript
// In this example, we use lodash to sum and average the values, but you can use whatever you want to aggregate.
constcolumns=[{
header:'Age',
accessor:'age',
aggregate:(values,rows)=>_.round(_.mean(values)),
render:row=>{
// You can even render the cell differently if it's an aggregated cell
Pivoted columns can be sorted just like regular columns, but not independently of each other. For instance, if you click to sort the pivot column in ascending order, it will sort by each pivot recursively in ascending order together.
## Sub Tables & Sub Components
By adding a `SubComponent` props, you can easily add an expansion level to all root-level rows:
If you want to handle pagination, and sorting on the server, `react-table` makes it easy on you.
1. Feed React Table `data` from somewhere dynamic. eg. `state`, a redux store, etc...
1. Add `manual` as a prop. This informs React Table that you'll be handling sorting and pagination server-side
1. Subscribe to the `onChange` prop. This function is called at `compomentDidMount` and any time sorting or pagination is changed by the user
1. In the `onChange` callback, request your data using the provided information in the params of the function (state and instance)
1. Update your data with the rows to be displayed
1. Optionally set how many pages there are total
```javascript
<ReactTable
...
data={this.state.data}// should default to []
pages={this.state.pages}// should default to -1 (which means we don't know how many pages we have)
loading={this.state.loading}
manual// informs React Table that you'll be handling sorting and pagination server-side
onChange={(state,instance)=>{
// show the loading overlay
this.setState({loading:true})
// fetch your data
Axios.post('mysite.com/data',{
page:state.page,
pageSize:state.pageSize,
sorting:state.sorting
})
.then((res)=>{
// Update react-table
this.setState({
data:res.data.rows,
pages:res.data.pages,
loading:false
})
})
}}
/>
```
For a detailed example, take a peek at our <a href="https://github.com/tannerlinsley/react-table/blob/master/stories/ServerSide.js" target="\_parent">async table mockup</a>
## Fully Controlled Component
React Table by default works fantastically out of the box, but you can achieve even more control and customization if you choose to maintain the state yourself. It is very easy to do, even if you only want to manage *parts* of the state.
Here are the props and their corresponding callbacks that control the state of the a table:
```javascript
<ReactTable
// Props
page={0}// the index of the page you wish to display
pageSize={20}// the number of rows per page to be displayed
sorting={[{
id:'lastName',
asc:true
},{
id:'firstName',
asc:true
}]}// the sorting model for the table
expandedRows={{
1:true,
4:true,
5:{
2:true,
3:true
}
}}// The nested row indexes on the current page that should appear expanded
// Callbacks
onPageChange={(pageIndex)=>{...}}// Called when the page index is changed by the user
onPageSizeChange={(pageSize,pageIndex)=>{...}}// Called when the pageSize is changed by the user. The resolve page is also sent to maintain approximate position in the data
onSortingChange={(column,shiftKey)=>{...}}// Called when a sortable column header is clicked with the column itself and if the shiftkey was held. If the column is a pivoted column, `column` will be an array of columns
onExpandRow={(index,event)=>{...}}// Called when an expander is clicked. Use this to manage `expandedRows`
/>
```
## Functional Rendering
Possibly one of the coolest features of React-Table is its ability to expose internal state for custom render logic. The easiest way to do this is to optionally pass a function as a child of `<ReactTable />`.
The function you pass will be called with the following items:
- Fully-resolved state of the table
- The standard table generator
- The instance of the component
You can then return any JSX or react you want! This turns out to be perfect for:
- Accessing the internal state of the table before rendering the table
- Decorating the table with more UI
- Building your own 100% custom display logic, while utilizing the state and methods of the table component
Example:
```javascript
<ReactTable
columns={columns}
data={data}
...
>
{(state,makeTable,instance)=>{
// Now you have full access to the state of the table!
state.decoratedColumns===[...]// all of the columns (with id's and meta)
state.visibleColumns===[...]// all of the columns (with id's and meta)
state.visibleColumns===[...]// all of the columns (with id's and meta)
// etc.
// `makeTable` is a function that returns the standard table markup
returnmakeTable()
// So add some decoration!
return(
<div>
<customPivotBySelect/>
<customColumnHideShow/>
<customAnything/>
{makeTable()}
</div>
)
// The possibilities are endless!!!
}}
</ReactTable>
```
## Multi-Sort
When clicking on a column header, hold shift to multi-sort! You can toggle `ascending``descending` and `none` for multi-sort columns. Clicking on a header without holding shift will clear the multi-sort and replace it with the single sort of that column. It's quite handy!
## Component Overrides
Though we confidently stand by the markup and architecture behind it, `react-table` does offer the ability to change the core componentry it uses to render everything. You can extend or override these internal components by passing a react component to it's corresponding prop on either the global props or on a one-off basis like so:
```javascript
// Change the global default
import{ReactTableDefaults}from'react-table'
Object.assign(ReactTableDefaults,{
TableComponent:Component,
TheadComponent:Component,
TbodyComponent:Component,
TrGroupComponent:Component,
TrComponent:Component,
ThComponent:Component,
TdComponent:Component,
PaginationComponent:Component,
PreviousComponent:Component,
NextComponent:Component,
LoadingComponent:Component,
ExpanderComponent:Component
})
// Or change per instance
<ReactTable
TableComponent={Component},
TheadComponent={Component},
// etc...
/>
```
If you choose to change the core components React-Table uses to render, you must make sure your replacement components consume and utilize all of the supplied and inherited props that are needed for that component to function properly. We would suggest investigating <a href="https://github.com/tannerlinsley/react-table/blob/master/src/index.js" target="\_parent">the source</a> for the component you wish to replace.
## Contributing
To suggest a feature, create an issue if it does not already exist.
If you would like to help develop a suggested feature follow these steps:
- Fork this repo
-`$ yarn`
-`$ yarn run storybook`
- Implement your changes to files in the `src/` directory
- View changes as you code via our <a href="https://github.com/storybooks/react-storybook" target="\_parent">React Storybook</a> `localhost:8000`
- Make changes to stories in `/stories`, or create a new one if needed
- Submit PR for review
#### Scripts
-`$ yarn run storybook` Runs the storybook server
-`$ yarn run test` Runs the test suite
-`$ yarn run prepublish` Builds the distributable bundle
-`$ yarn run docs` Builds the website/docs from the storybook for github pages
- Lightweight (5kb - 14kb+ depending on features used and tree-shaking)
-Headless (100% customizable, Bring-your-own-UI)
-Auto out of the box, fully controllable API
-Sorting (Multi and Stable)
-Filters
-Pivoting & Aggregation
-Row Selection
- Row Expansion
- Column Ordering
- Animatable
- Virtualizable
-Resizable
-Server-side/controlled data/state
-Extensible via hook-based plugin system
## Documentation
Visit our new documentation site at https://react-table.js.org
## Sponsors
This library is being built and maintained by me, @tannerlinsley and I am always in need of more support to keep this project afloat. If you would like to get additional support, add your logo or name on this README, or simply just contribute to my open source Sponsorship goal, [visit my Github Sponsors page!](https://github.com/sponsors/tannerlinsley/)
### [Become a Sponsor](https://github.com/sponsors/tannerlinsley/)
## Previous Versions
### Version 6
v6 is a great library and while it is still available to install and use, I am no longer offering any long-term support for it. If you intend to keep using v6, I recommend maintaining your own fork of the library and keeping it up to date for your version of React.
#### Where are the docs for the older v6 version?
Please [visit the v6 branch](https://github.com/tannerlinsley/react-table/tree/v6)
#### I want to migrate from v6 to v7. How do I do that?
The differences between the 2 versions are incredibly massive. Unfortunately, I cannot write a one-to-one upgrade guide for any of v6's API, simply because much of it is irrelevant with v7's headless approach. The best approach for migrating to v7 is to learn its API by reading the documentation and then following some of the examples to begin building your own table component.
In case you would need to have both v6 and v7 in one app during the migration process (large codebase, complex use cases), you can either (1) fork and maintain your own local version of React Table v6 or (2) install the [`react-table-6` alias package](https://www.npmjs.com/package/react-table-6) for use alongside the `react-table` package.
Types for React Table are maintained externally by the Typescript community and are located at https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-table.
Because React Table is not written in Typescript and the types are not maintained by the core team, there are no guarantees around the types always being up to date or working perfectly. If this is an issue for you, please contribute to the community types and discuss solutions there.
React Table uses React Hooks both internally and externally for almost all of its configuration and lifecycle management. Naturally, this is what allows React Table to be headless and lightweight while still having a concise and simple API.
React Table is essentially a compatible collection of **custom React hooks**:
- Want your custom plugin hook listed here? [Submit a PR!](https://github.com/tannerlinsley/react-table/compare)
### Hook Usage
`useTable` is the **primary** hook used to build a React Table. It serves as the starting point for **every option and every plugin hook** that React Table supports. The options passed into `useTable` are supplied to every plugin hook after it in the order they are supplied, eventually resulting in a final `instance` object that you can use to build your table UI and interact with the table's state.
```js
constinstance=useTable(
{
data:[...],
columns:[...],
},
useGroupBy,
useFilters,
useSortBy,
useExpanded,
usePagination
)
```
### The stages of React Table and plugins
1.`useTable` is called. A table instance is created.
1. The `instance.state` is resolved from either a custom user state or an automatically generated one.
1. A collection of plugin points is created at `instance.hooks`.
1. Each plugin is given the opportunity to add hooks to `instance.hook`.
1. As the `useTable` logic proceeds to run, each plugin hook type is used at a specific point in time with each individual hook function being executed the order it was registered.
1. The final instance object is returned from `useTable`, which the developer then uses to construct their table.
This multi-stage process is the secret sauce that allows React Table plugin hooks to work together and compose nicely, while not stepping on each others toes.
To dive deeper into plugins, see Plugins and the Plugin Guide
### Plugin Hook Order & Consistency
The order and usage of plugin hooks must follow The Laws of Hooks, just like any other custom hook. They must always be unconditionally called in the same order.
> **NOTE: In the event that you want to programmatically enable or disable plugin hooks, most of them provide options to disable their functionality, eg. `options.disableSortBy`**
### Option Memoization
React Table relies on memoization to determine when state and side effects should update or be calculated. This means that every option you pass to `useTable` should be memoized either via [`React.useMemo`](https://reactjs.org/docs/hooks-reference.html#usememo) (for objects) or [`React.useCallback`](https://reactjs.org/docs/hooks-reference.html#usecallback) (for functions).
`useAbsoluteLayout` is a plugin hook that adds support for headers and cells to be rendered as absolutely positioned `div`s (or other non-table elements) with explicit `width`. Similar to the `useBlockLayout` hook, this becomes useful if and when you need to virtualize rows and cells for performance.
**NOTE:** Although no additional options are needed for this plugin to work, the core column options `width`, `minWidth` and `maxWidth` are used to calculate column and cell widths and must be set. [See Column Options](#column-options) for more information on these options.
### Instance Properties
-`getTableBodyProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for the table body
### Row Properties
-`getRowProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for rows
### Cell Properties
-`getCellProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for rows cells
### HeaderGroup Properties
-`getHeaderGroupProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for headers
### Header Properties
-`getHeaderProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for headers
`useBlocklayout` is a plugin hook that adds support for headers and cells to be rendered as `inline-block``div`s (or other non-table elements) with explicit `width`. Similar to the `useAbsoluteLayout` hook, this becomes useful if and when you need to virtualize rows and cells for performance.
**NOTE:** Although no additional options are needed for this plugin to work, the core column options `width`, `minWidth` and `maxWidth` are used to calculate column and cell widths and must be set. [See Column Options](#column-options) for more information on these options.
### Row Properties
-`getRowProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for rows
### Cell Properties
-`getCellProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for rows cells
### HeaderGroup Properties
-`getHeaderGroupProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for headers
### Header Properties
-`getHeaderProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for headers
`useColumnOrder` is a plugin hook that implements **basic column reordering**. As columns are reordered, their header groups are reverse-engineered so as to never have orphaned header groups.
### Table Options
The following options are supported via the main options object passed to `useTable(options)`
-`initialState.columnOrder: Array<ColumnId>`
- Optional
- Defaults to `[]`
- Any column ID's not represented in this array will be naturally ordered based on their position in the original table's `column` structure
### Instance Properties
The following values are provided to the table `instance`:
-`setColumnOrder: Function(updater: Function | Array<ColumnId>) => void`
- Use this function to programmatically update the columnOrder.
-`updater` can be a function or value. If a `function` is passed, it will receive the current value and expect a new one to be returned.
`useExpanded` is the hook that implements **row expanding**. It is most often used with `useGroupBy` to expand grouped rows or on its own with nested `subRows` in tree-like `data` sets, but is not limited to these use-cases. It supports expanding rows both via internal table state and also via a hard-coded key on the raw row model.
### Table Options
The following options are supported via the main options object passed to `useTable(options)`
- An `object` of expanded row IDs with boolean property values.
- If a row's id is set to true in this object, that row will have an expanded state. For example, if `{ '3': true }` was passed as the `expanded` state, by default the **4th row in the original data array** would be expanded, since it would have that ID
- For nested expansion, you can **use nested IDs like `1.3`** to expand sub rows. For example, if `{ '3': true, '3.5': true }` was passed as the `expanded` state, then the **the 4th row would be expanded, along with the 6th subRow of the 4th row as well**.
- This information is stored in state since the table is allowed to manipulate the filter through user interaction.
- See the [useTable hook](#table-options) for more details
-`manualExpandedKey: String`
- Optional
- Defaults to `expanded`
- This string is used as the key to detect manual expanded state on any given row. For example, if a raw data row like `{ name: 'Tanner Linsley', friends: [...], expanded: true}` was detected, it would always be expanded, regardless of state.
-`expandSubRows: Bool`
- Optional
- Defaults to `true`
- If set to `true`, expanded rows are rendered along with normal rows.
- If set to `false`, expanded rows will only be available through their parent row. This could be useful if you are implementing a custom expanded row view.
-`autoResetExpanded: Boolean`
- Defaults to `true`
- When `true`, the `expanded` state will automatically reset if any of the following conditions are met:
-`data` is changed
- To disable, set to `false`
- For more information see the FAQ ["How do I stop my table state from automatically resetting when my data changes?"](/faq#how-do-i-stop-my-table-state-from-automatically-resetting-when-my-data-changes)
### Instance Properties
The following properties are available on the table instance returned from `useTable`
- A function to toggle whether a row is expanded or not. The `isExpanded` boolean is optional, otherwise it will be a true toggle action
-`toggleAllRowsExpanded: Function(isExpanded?)`
- A function to toggle whether all of the rows in the table are expanded or not. The `isExpanded` boolean is optional, otherwise it will be a true toggle action
- This function will toggle the expanded state of a row between `true` and `false` or, if an `isExpanded` boolean is passed to the function, it will be set as the new `isExpanded` value.
- Rows with a hard-coded `manualExpandedKey` (defaults to `expanded`) set to `true` are not affected by this function or the internal expanded state.
`useFilters` is the hook that implements **row filtering** and can even be used in conjunction with `useGlobalFilter`. It's also important to note that this hook can be used either **before or after**`useGlobalFilter`, depending on the performance characteristics you want to code for.
### Table Options
The following options are supported via the main options object passed to `useTable(options)`
- An array of objects containing columnId's and their corresponding filter values. This information is stored in state since the table is allowed to manipulate the filter through user interaction.
-`manualFilters: Bool`
- Enables filter detection functionality, but does not automatically perform row filtering.
- Turn this on if you wish to implement your own row filter outside of the table (eg. server-side or manual row grouping/nesting)
-`disableFilters: Bool`
- Disables filtering for every column in the entire table.
-`defaultCanFilter: Bool`
- Optional
- Defaults to `false`
- If set to `true`, all columns will be filterable, regardless if they have a valid `accessor`
-`filterTypes: Object<filterKey: filterType>`
- Must be **memoized**
- Allows overriding or adding additional filter types for columns to use. If a column's filter type isn't found on this object, it will default to using the built-in filter types.
- For more information on filter types, see Filtering
-`autoResetFilters: Boolean`
- Defaults to `true`
- When `true`, the `filters` state will automatically reset if any of the following conditions are met:
-`data` is changed
- To disable, set to `false`
- For more information see the FAQ ["How do I stop my table state from automatically resetting when my data changes?"](../faq#how-do-i-stop-my-table-state-from-automatically-resetting-when-my-data-changes)
### Column Options
The following options are supported on any `Column` object passed to the `columns` options in `useTable()`
-`Filter: Function | React.Component => JSX`
- **Required**
- Receives the table instance and column model as props
- Must return valid JSX
- This function (or component) is used to render this column's filter UI, eg.
-`disableFilters: Bool`
- Optional
- If set to `true`, will disable filtering for this column
-`defaultCanFilter: Bool`
- Optional
- Defaults to `false`
- If set to `true`, this column will be filterable, regardless if it has a valid `accessor`
-`filter: String | Function`
- Optional
- Defaults to `text`
- The resolved function from the this string/function will be used to filter the this column's data.
- If a `string` is passed, the function with that name located on either the custom `filterTypes` option or the built-in filtering types object will be used. If
- If a `function` is passed, it will be used directly.
- For more information on filter types, see Filtering
- If a **function** is passed, it must be **memoized**
### Instance Properties
The following values are provided to the table `instance`:
-`rows: Array<Row>`
- An array of **filtered** rows.
-`preFilteredRows: Array<Row>`
- The array of rows **used right before filtering**.
- Among many other use-cases, these rows are directly useful for building option lists in filters, since the resulting filtered `rows` do not contain every possible option.
`useFlexLayout` is a plugin hook that adds support for headers and cells to be rendered as `inline-block``div`s (or other non-table elements) with `width` being used as the flex-basis and flex-grow. This hook becomes useful when implementing both virtualized and resizable tables that must also be able to stretch to fill all available space.
**NOTE:** Although no additional options are needed for this plugin to work, the core column options `width`, `minWidth` and `maxWidth` are used to calculate column and cell widths and must be set:
-`minWidth` is only used to limit column resizing. It does not define the minimum width for a column.
-`width` is used as both the `flex-basis` and `flex-grow`. This means that it essentially acts as both the minimum width and flex-ratio of the column.
-`maxWidth` is only used to limit column resizing. It does not define the maximum width for a column.
[See Column Options](#column-options) for more information on these options.
### Row Properties
-`getRowProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for rows
### Cell Properties
-`getCellProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for rows cells
### HeaderGroup Properties
-`getHeaderGroupProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for headers
### Header Properties
-`getHeaderProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for headers
`useGlobalFilter` is the hook that implements **global row filtering** and can even be used in conjunction with `useFilters`. It's also important to note that this hook can be used either **before or after**`useFilters`, depending on the performance characteristics you want to code for.
### Table Options
The following options are supported via the main options object passed to `useTable(options)`
-`initialState.globalFilter: any`
- Must be **memoized**
- An array of objects containing columnId's and their corresponding filter values. This information is stored in state since the table is allowed to manipulate the filter through user interaction.
-`globalFilter: String | Function`
- Optional
- Defaults to `text`
- The resolved function from the this string/function will be used to filter the table's data.
- If a `string` is passed, the function with that name located on either the custom `filterTypes` option or the built-in filtering types object will be used. If
- If a `function` is passed, it will be used directly.
- For more information on filter types, see Filtering
- If a **function** is passed, it must be **memoized**
-`manualGlobalFilter: Bool`
- Enables filter detection functionality, but does not automatically perform row filtering.
- Turn this on if you wish to implement your own row filter outside of the table (eg. server-side or manual row grouping/nesting)
-`disableGlobalFilter: Bool`
- Disables global filtering for every column in the entire table.
-`filterTypes: Object<filterKey: filterType>`
- Must be **memoized**
- Allows overriding or adding additional filter types for the table to use. If the globalFilter type isn't found on this object, it will default to using the built-in filter types.
- For more information on filter types, see Filtering
-`autoResetGlobalFilter: Boolean`
- Defaults to `true`
- When `true`, the `globalFilter` state will automatically reset if any of the following conditions are met:
-`data` is changed
- To disable, set to `false`
- For more information see the FAQ ["How do I stop my table state from automatically resetting when my data changes?"](./faq#how-do-i-stop-my-table-state-from-automatically-resetting-when-my-data-changes)
### Column Options
The following options are supported on any `Column` object passed to the `columns` option in `useTable()`
-`disableGlobalFilter: Bool`
- Optional
- If set to `true`, will disable global filtering for this column
### Instance Properties
The following values are provided to the table `instance`:
-`rows: Array<Row>`
- An array of **filtered** rows.
-`preGlobalFilteredRows: Array<Row>`
- The array of rows **used right before filtering**.
- Among many other use-cases, these rows are directly useful for building option lists in filters, since the resulting filtered `rows` do not contain every possible option.
-`setGlobalFilter: Function(filterValue) => void`
- An instance-level function used to update the global filter value.
`useGroupBy` is the hook that implements **row grouping and aggregation**.
- Each column's `getGroupByToggleProps()` function can be used to generate the props needed to make a clickable UI element that will toggle the grouping on or off for a specific column.
- Instance and column-level `toggleGroupBy` functions are also made available for programmatic grouping.
### Table Options
The following options are supported via the main options object passed to `useTable(options)`
-`initialState.groupBy: Array<String>`
- Must be **memoized**
- An array of groupBy ID strings, controlling which columns are used to calculate row grouping and aggregation. This information is stored in state since the table is allowed to manipulate the groupBy through user interaction.
-`manualGroupBy: Bool`
- Enables groupBy detection and functionality, but does not automatically perform row grouping.
- Turn this on if you wish to implement your own row grouping outside of the table (eg. server-side or manual row grouping/nesting)
- Allows overriding or adding additional aggregation functions for use when grouping/aggregating row values. If an aggregation key isn't found on this object, it will default to using the built-in aggregation functions
-`groupByFn: Function`
- Must be **memoized**
- Defaults to `defaultGroupByFn`
- This function is responsible for grouping rows based on the `state.groupBy` keys provided. It's very rare you would need to customize this function.
### Column Options
The following options are supported on any `Column` object passed to the `columns` options in `useTable()`
-`Aggregated: Function | React.Component => JSX`
- Optional
- Defaults to this column's `Cell` formatter
- Receives the table instance and cell model as props
- Must return valid JSX
- This function (or component) formats this column's value when it is being grouped and aggregated, eg. If this column was showing the number of visits for a user to a website and it was currently being grouped to show an **average** of the values, the `Aggregated` function for this column could format that value to `1,000 Avg. Visits`
- Used to aggregate values across rows, eg. `average`-ing the ages of many cells in a table"
- If a single `String` is passed, it must be the key of either a user defined or predefined `aggregations` function.
- If a `Function` is passed, this function will receive both the leaf-row values and (if the rows have already been aggregated, the previously aggregated values) to be aggregated into a single value.
- The function signature for all aggregation functions is `(leafValues, aggregatedValues) => aggregatedValue` where `leafValues` is a flat array containing all leaf rows currently grouped at the aggregation level and `aggregatedValues` is an array containing the aggregated values from the immediate child sub rows. Each has purpose in the types of aggregations they power where optimizations are made for either accuracy or performance.
- For examples on how an aggregation functions work, see the source code for the built in aggregations in the [src/aggregations.js](../../src/aggregations.js) file.
- When attempting to group/aggregate non primitive cell values (eg. arrays of items) you will likely need to resolve a stable primitive value like a number or string to use in normal row aggregations. This property can be used to aggregate or simply access the value to be used in aggregations eg. `count`-ing the unique number of items in a cell's array value before `sum`-ing that count across the table.
- If a single `String` is passed, it must be the key of either a user defined or predefined `aggregations` function.
- If a `Function` is passed, this function will receive the cell's accessed value, the original `row` object and the `column` associated with the cell
-`disableGroupBy: Boolean`
- Defaults to `false`
- If `true`, will disable grouping for this column.
### Instance Properties
The following values are provided to the table `instance`:
-`rows: Array<Row>`
- An array of **grouped and aggregated** rows.
-`preGroupedRows: Array<Row>`
- The array of rows originally used to create the grouped rows.
- This function is used to resolve any props needed for this column's UI that is responsible for toggling grouping when the user clicks it.
- You can use the `getGroupByToggleProps` hook to extend its functionality.
- Custom props may be passed. **NOTE: Custom props may override built-in sortBy props, so be careful!**
### Row Properties
The following properties are available on every `Row` object returned by the table instance.
-`groupById: String`
- The column ID for which this row is being grouped.
- Will be `undefined` if the row is an original row from `data` and not a materialized one from the grouping.
-`groupByVal: any`
- If the row is a materialized group row, this will be the grouping value that was used to create it.
-`values: Object`
- Similar to a regular row, a materialized grouping row also has a `values` object
- This object contains the **aggregated** values for this row's sub rows
-`subRows: Array<Row>`
- If the row is a materialized group row, this property is the array of materialized subRows that were grouped inside of this row.
-`leafRows: Array<Row>`
- If the row is a materialized group row, this property is an array containing all leaf node rows aggregated into this row.
-`depth: Int`
- If the row is a materialized group row, this is the grouping depth at which this row was created.
-`id: String`
- The unique ID for this row.
- This ID is unique across all rows, including sub rows
- Derived from the `getRowId` function, which defaults to chaining parent IDs and joining with a `.`
- If a row is a materialized grouping row, it will have an ID in the format of `columnId:groupByVal`.
-`isAggregated: Bool`
- Will be `true` if the row is an aggregated row
### Cell Properties
The following additional properties are available on every `Cell` object returned in an array of `cells` on every row object.
-`isGrouped: Bool`
- If `true`, this cell is a grouped cell, meaning it contains a grouping value and should usually display and expander.
-`isPlaceholder: Bool`
- If `true`, this cell is a repeated value cell, meaning it contains a value that is already being displayed elsewhere (usually by a parent row's cell).
- Most of the time, this cell is not required to be displayed and can safely be hidden during rendering
-`isAggregated: Bool`
- If `true`, this cell's value has been aggregated and should probably be rendered with the `Aggregated` cell renderer.
`usePagination` is the hook that implements **row pagination**. It can be used for both client-side pagination or server-side pagination. For more information on pagination, see Pagination
> **NOTE** Some server-side pagination implementations do not use page index and instead use **token based pagination**! If that's the case, please use the `useTokenPagination` plugin instead.
### Table Options
The following options are supported via the main options object passed to `useTable(options)`
-`initialState.pageSize: Int`
- **Required**
- Defaults to `10`
- Determines the amount of rows on any given page
-`initialState.pageIndex: Int`
- **Required**
- Defaults to `0`
- The index of the page that should be displayed via the `page` instance value
-`pageCount: Int`
- **Required if `manualPagination` is set to `true`**
- If `manualPagination` is `true`, then this value used to determine the amount of pages available. This amount is then used to materialize the `pageOptions` and also compute the `canNextPage` values on the table instance.
-`manualPagination: Bool`
- Enables pagination functionality, but does not automatically perform row pagination.
- Turn this on if you wish to implement your own pagination outside of the table (eg. server-side pagination or any other manual pagination technique)
-`autoResetPage: Boolean`
- Defaults to `true`
- When `true`, the `pageIndex` state will automatically reset if `manualPagination` is `false` and any of the following conditions are met:
-`data` is changed
-`manualSortBy` is `false` and `state.sortBy` is changed
-`manualGlobalFilter` is `false` and `state.globalFilter` is changed
-`manualFilters` is `false` and `state.filters` is changed
-`manualGroupBy` is `false` and `state.groupBy` is changed
- To disable, set to `false`
- For more information see the FAQ ["How do I stop my table state from automatically resetting when my data changes?"](/faq#how-do-i-stop-my-table-state-from-automatically-resetting-when-my-data-changes)
-`paginateExpandedRows: Bool`
- Optional
- Only applies when using the `useExpanded` plugin hook simultaneously
- Defaults to `true`
- If set to `true`, expanded rows are paginated along with normal rows. This results in stable page sizes across every page.
- If set to `false`, expanded rows will be spliced in after pagination. This means that the total number of rows in a page can potentially be larger than the page size, depending on how many subrows are expanded.
### Instance Properties
The following values are provided to the table `instance`:
-`state.pageIndex: Int`
- This is the current `pageIndex` value, located on the state.
-`state.pageSize: Int`
- This is the current `pageSize` value, located on the state.
-`page: Array<row>`
- An array of rows for the **current** page, determined by the current `pageIndex` value.
-`pageCount: Int`
- If `manualPagination` is set to `false`, this is the total amount of pages available in the table based on the current `pageSize` value
- if `manualPagination` is set to `true`, this is merely the same `pageCount` option that was passed in the table options.
-`pageOptions: Array<Int>`
- An array of zero-based index integers corresponding to available pages in the table.
- This can be useful for generating things like select interfaces for the user to select a page from a list, instead of manually paginating to the desired page.
-`canPreviousPage: Bool`
- If there are pages and the current `pageIndex` is greater than `0`, this will be `true`
-`canNextPage:`
- If there are pages and the current `pageIndex` is less than `pageCount`, this will be `true`
-`gotoPage: Function(pageIndex)`
- This function, when called with a valid `pageIndex`, will set `pageIndex` to that value.
- If the aginateassed index is outside of the valid `pageIndex` range, then this function will do nothing.
-`previousPage: Function`
- This function decreases `state.pageIndex` by one.
- If there are no pages or `canPreviousPage` is false, this function will do nothing.
-`nextPage: Function`
- This function increases `state.pageIndex` by one.
- If there are no pages or `canNextPage` is false, this function will do nothing.
-`setPageSize: Function(pageSize)`
- This function sets `state.pageSize` to the new value.
- As a result of a pageSize change, a new `state.pageIndex` is also calculated. It is calculated via `Math.floor(currentTopRowIndex / newPageSize)`
`useResizeColumns` is a plugin hook that adds support for resizing headers and cells when using non-table elements for layout eg. the `useBlockLayout` and `useAbsoluteLayout` hooks. It even supports resizing column groups!
### Table Options
-`disableResizing: Bool`
- Defaults to `false`
- When set to `true`, resizing is disabled across the entire table
### Column Options
The core column options `width`, `minWidth` and `maxWidth` are used to calculate column and cell widths and must be set. [See Column Options](#column-options) for more information on these options.
-`disableResizing: Bool`
- Defaults to `false`
- When set to `true`, resizing is disabled for this column
### Header Properties
-`getResizerProps`
- **Usage Required**
- This core prop getter is required to to enable absolute layout for headers
-`canResize: Bool`
- Will be `true` if this column can be resized
-`isResizing: Bool`
- Will be `true` if this column is currently being resized
- If a row's ID is set to `true` in this object, it will have a selected state.
-`manualRowSelectedKey: String`
- Optional
- Defaults to `isSelected`
- If this key is found on the **original** data row, and it is true, this row will be manually selected
-`autoResetSelectedRows: Boolean`
- Defaults to `true`
- When `true`, the `selectedRowIds` state will automatically reset if any of the following conditions are met:
-`data` is changed
- To disable, set to `false`
- For more information see the FAQ ["How do I stop my table state from automatically resetting when my data changes?"](./faq#how-do-i-stop-my-table-state-from-automatically-resetting-when-my-data-changes)
### Instance Properties
The following values are provided to the table `instance`:
- This function should return the initial state for a row.
- If this function is defined, it will be passed a `Row` object, from which you can return a value to use as the initial state, eg. `row => row.original.initialState`
- This function should return the initial state for a cell.
- If this function is defined, it will be passed a `Cell` object, from which you can return a value to use as the initial state, eg. `cell => cell.row.original.initialCellState[cell.column.id]`
-`autoResetRowState: Boolean`
- Defaults to `true`
- When `true`, the `rowState` state will automatically reset if any of the following conditions are met:
-`data` is changed
- To disable, set to `false`
- For more information see the FAQ ["How do I stop my table state from automatically resetting when my data changes?"](./faq#how-do-i-stop-my-table-state-from-automatically-resetting-when-my-data-changes)
### Instance Properties
The following values are provided to the table `instance`:
-`setRowState: Function(rowPath: Array<string>, updater: Function | Any) => void`
- Use this function to programmatically update the state of a row.
-`updater` can be a function or value. If a `function` is passed, it will receive the current value and expect a new one to be returned.
`useSortBy` is the hook that implements **row sorting**. It also support multi-sort (keyboard required).
- Multi-sort is enabled by default
- To sort the table via UI, attach the props generated from each column's `getSortByToggleProps()`, then click any of those elements.
- To multi-sort the table via UI, hold `shift` while clicking on any of those same elements that have the props from `getSortByToggleProps()` attached.
- To programmatically sort (or multi-sort) any column, use the `toggleSortBy` method located on the instance or each individual column.
### Table Options
The following options are supported via the main options object passed to `useTable(options)`
- An array of sorting objects. If there is more than one object in the array, multi-sorting will be enabled. Each sorting object should contain an `id` key with the corresponding column ID to sort by. An optional `desc` key may be set to true or false to indicated ascending or descending sorting for that column. This information is stored in state since the table is allowed to manipulate the filter through user interaction.
-`manualSortBy: Bool`
- Enables sorting detection functionality, but does not automatically perform row sorting. Turn this on if you wish to implement your own sorting outside of the table (eg. server-side or manual row grouping/nesting)
-`disableSortBy: Bool`
- Disables sorting for every column in the entire table.
-`defaultCanSort: Bool`
- Optional
- Defaults to `false`
- If set to `true`, all columns will be sortable, regardless if they have a valid `accessor`
-`disableMultiSort: Bool`
- Disables multi-sorting for the entire table.
-`isMultiSortEvent: Function`
- Allows to override default multisort behaviour(i.e. multisort applies when shift key is pressed), if this function is provided then returned boolean value from this function will make decision whether newly applied sort action will be considered as multisort or not.
- Receives `event` as argument.
-`maxMultiSortColCount: Number`
- Limit on max number of columns for multisort, e.g. if set to 3, and suppose table is sorted by `[A, B, C]` and then clicking `D` for sorting should result in table sorted by `[B, C , D]`
-`disableSortRemove: Bool`
- If true, the un-sorted state will not be available to columns once they have been sorted.
-`disableMultiRemove: Bool`
- If true, the un-sorted state will not be available to multi-sorted columns.
-`orderByFn: Function`
- Must be **memoized**
- Defaults to the built-in default orderBy function
- This function is responsible for composing multiple sorting functions together for multi-sorting, and also handles both the directional sorting and stable-sorting tie breaking. Rarely would you want to override this function unless you have a very advanced use-case that requires it.
-`sortTypes: Object<sortKey: sortType>`
- Must be **memoized**
- Allows overriding or adding additional sort types for columns to use. If a column's sort type isn't found on this object, it will default to using the built-in sort types.
- For more information on sort types, see Sorting
-`autoResetSortBy: Boolean`
- Defaults to `true`
- When `true`, the `sortBy` state will automatically reset if any of the following conditions are met:
-`data` is changed
- To disable, set to `false`
- For more information see the FAQ ["How do I stop my table state from automatically resetting when my data changes?"](/faq#how-do-i-stop-my-table-state-from-automatically-resetting-when-my-data-changes)
### Column Options
The following options are supported on any `Column` object passed to the `columns` options in `useTable()`
-`defaultCanSort: Bool`
- Optional
- Defaults to `false`
- If set to `true`, this column will be sortable, regardless if it has a valid `accessor`
-`disableSortBy: Bool`
- Optional
- Defaults to `false`
- If set to `true`, the sorting for this column will be disabled
-`sortDescFirst: Bool`
- Optional
- Defaults to `false`
- If set to `true`, the first sort direction for this column will be descending instead of ascending
-`sortInverted: Bool`
- Optional
- Defaults to `false`
- If set to `true`, the underlying sorting direction will be inverted, but the UI will not.
- This may be useful in situations where positive and negative connotation is inverted, eg. a Golfing score where a lower score is considered more positive than a higher one.
- Used to compare 2 rows of data and order them correctly.
- If a **function** is passed, it must be **memoized**
- String options: `basic`, `datetime`, `alphanumeric`. Defaults to `alphanumeric`.
- The resolved function from the this string/function will be used to sort the this column's data.
- If a `string` is passed, the function with that name located on either the custom `sortTypes` option or the built-in sorting types object will be used.
- If a `function` is passed, it will be used.
- For more information on sort types, see Sorting
### Instance Properties
The following values are provided to the table `instance`:
- This function can be used to programmatically toggle the sorting for this column.
- This function is similar to the `instance`-level `toggleSortBy`, however, passing a columnId is not required since it is located on a `Column` object already.
-`getSortByToggleProps: Function(props) => props`
- **Required**
- This function is used to resolve any props needed for this column's UI that is responsible for toggling the sort direction when the user clicks it.
- You can use the `getSortByToggleProps` hook to extend its functionality.
- Custom props may be passed. **NOTE: Custom props may override built-in sortBy props, so be careful!**
-`clearSortBy: Function() => void`
- This function can be used to programmatically clear the sorting for this column.
-`isSorted: Boolean`
- Denotes whether this column is currently being sorted
-`sortedIndex: Int`
- If the column is currently sorted, this integer will be the index in the `sortBy` array from state that corresponds to this column.
- If this column is not sorted, the index will always be `-1`
-`isSortedDesc: Bool`
- If the column is currently sorted, this denotes whether the column's sort direction is descending or not.
- If `true`, the column is sorted `descending`
- If `false`, the column is sorted `ascending`
- If `undefined`, the column is not currently being sorted.
`useTable` is the root hook for React Table. To use it, pass it with an optionsobject with at least a `columns` and `data` value, followed by any React Table compatible hooks you want to use.
### Table Options
The following options are supported via the main options object passed to `useTable(options)`
-`columns: Array<Column>`
- Required
- Must be **memoized**
- The core columns configuration object for the entire table.
- Supports nested `columns` arrays via the column's `columns` key, eg. `[{ Header: 'My Group', columns: [...] }]`
-`data: Array<any>`
- Required
- Must be **memoized**
- The data array that you want to display on the table.
-`initialState: Object`
- Optional
- The initial state object for the table.
- Upon table initialization, this object is **merged over the table's `defaultState` object** (eg. `{...defaultState, ...initialState}`) that React Table and its hooks use to register default state to produce the final initial state object passed to the `React.useState` hook internally.
- With every action that is dispatched to the table's internal `React.useReducer` instance, this reducer is called and is allowed to modify the final state object for updating.
- It is passed the `newState`, `action`, and `prevState` and is expected to either return the `newState` or a modified version of the `newState`
- May also be used to "control" the state of the table, by overriding certain pieces of state regardless of the action.
- If you need to control part of the table state, this is the place to do it.
- This function is run on every single render, just like a hook and allows you to alter the final state of the table if necessary.
- You can use hooks inside of this function, but most of the time, we just suggest using `React.useMemo` to memoize your state overrides.
- See the FAQ ["How can I manually control the table state?"](/faq#how-can-i-manually-control-the-table-state) for a an example.
-`defaultColumn: Object`
- Optional
- Defaults to `{}`
- The default column object for every column passed to React Table.
- Column-specific properties will override the properties in this object, eg. `{ ...defaultColumn, ...userColumn }`
- This is particularly useful for adding global column properties. For instance, when using the `useFilters` plugin hook, add a default `Filter` renderer for every column, eg.`{ Filter: MyDefaultFilterComponent }`
-`initialRowStateKey: String`
- Optional
- Defaults to `initialState`
- This key is used to look for the initial state of a row when initializing the `rowState` for a`data` array.
- If the value located at `row[initialRowStateKey]` is falsey, `{}` will be used instead.
- This string/function is used to build the data model for your column.
- The data returned by an accessor should be **primitive** and sortable.
- If a string is passed, the column's value will be looked up on the original row via that key, eg. If your column's accessor is `firstName` then its value would be read from `row['firstName']`. You can also specify deeply nested values with accessors like `info.hobbies` or even `address[0].street`
- If a function is passed, the column's value will be looked up on the original row using this accessor function, eg. If your column's accessor is `row => row.firstName`, then its value would be determined by passing the row to this function and using the resulting value.
- Technically speaking, this field isn't required if you have a unique `id` for a column. This is used for things like expander or row selection columns. **Warning**: Only omit `accessor` if you really know what you're doing.
-`id: String`
- **Required if `accessor` is a function**
- This is the unique ID for the column. It is used by reference in things like sorting, grouping, filtering etc.
- If a **string** accessor is used, it defaults as the column ID, but can be overridden if necessary.
-`columns: Array<Column>`
- Optional
- A nested array of columns.
- If defined, the column will act as a header group. Columns can be recursively nested as much as needed.
-`Header: String | Function | React.Component => JSX`
- Optional
- Defaults to `() => null`
- Receives the table instance and column model as props
- Must either be a **string or return valid JSX**
- If a function/component is passed, it will be used for formatting the header value, eg. You can use a `Header` function to dynamically format the header using any table or column state.
-`Cell: Function | React.Component => JSX`
- Optional
- Defaults to `({ value }) => String(value)`
- Receives the table instance and cell model as props
- Must return valid JSX
- This function (or component) is primarily used for formatting the column value, eg. If your column accessor returns a date object, you can use a `Cell` function to format that date to a readable format.
-`width: Int`
- Optional
- Defaults to `150`
- Specifies the width for the column (when using non-table-element layouts)
-`minWidth: Int`
- Optional
- Defaults to `0`
- Specifies the minimum width for the column (when using non-table-element layouts)
- Specifically useful when using plugin hooks that allow the user to resize column widths
-`maxWidth: Int`
- Optional
- Defaults to `0`
- Specifies the maximum width for the column (when using non-table-element layouts)
- Specifically useful when using plugin hooks that allow the user to resize column widths
### Instance Properties
The following properties are available on the table instance returned from `useTable`
-`state: Object`
- **Memoized** - This object reference will not change unless the internal table state is modified.
- This is the final state object of the table, which is the product of the `initialState`, internal table reducer and (optionally) a custom `reducer` supplied by the user.
-`columns: Array<Column>`
- A **nested** array of final column objects, **similar in structure to the original columns configuration option**.
- See [Column Properties](#column-properties) for more information
-`allColumns: Array<Column>`
- A **flat** array of all final column objects.
- See [Column Properties](#column-properties) for more information
-`visibleColumns: Array<Column>`
- A **flat** array of all visible column objects derived from `allColumns`.
- See [Column Properties](#column-properties) for more information
-`headerGroups: Array<HeaderGroup>`
- An array of normalized header groups, each containing a flattened array of final column objects for that row.
- **Some of these headers may be materialized as placeholders**
- See [HeaderGroup Properties](#headergroup-properties) for more information
-`footerGroups: Array<HeaderGroup>`
- An array of normalized header groups, but in reverse order, each containing a flattened array of final column objects for that row.
- **Some of these headers may be materialized as placeholders**
- See [HeaderGroup Properties](#headergroup-properties) for more information
-`headers: Array<Column>`
- A **nested** array of final header objects, **similar in structure to the original columns configuration option, but rebuilt for ordering**
- Each contains the headers that are displayed underneath it.
- **Some of these headers may be materialized as placeholders**
- See [Column Properties](#column-properties) for more information
-`flatHeaders[] Array<Column>`
- A **flat** array of final header objects found in each header group.
- **Some of these headers may be materialized as placeholders**
- See [Column Properties](#column-properties) for more information
-`rows: Array<Row>`
- An array of **materialized row objects** from the original `data` array and `columns` passed into the table options
- See [Row Properties](#row-properties) for more information
-`getTableProps: Function(?props)`
- **Required**
- This function is used to resolve any props needed for your table wrapper.
- Custom props may be passed. **NOTE: Custom props will override built-in table props, so be careful!**
-`getTableBodyProps: Function(?props)`
- **Required**
- This function is used to resolve any props needed for your table body wrapper.
- Custom props may be passed. **NOTE: Custom props will override built-in table body props, so be careful!**
-`prepareRow: Function(Row)`
- **Required**
- This function is responsible for lazily preparing a row for rendering. Any row that you intend to render in your table needs to be passed to this function **before every render**.
- **Why?** Since table data could potentially be very large, it can become very expensive to compute all of the necessary state for every row to be rendered regardless if it actually is rendered or not (for example if you are paginating or virtualizing the rows, you may only have a few rows visible at any given moment). This function allows only the rows you intend to display to be computed and prepped with the correct state.
-`flatRows: Array<Row>`
- An array of all rows, including subRows which have been flattened into the order in which they were detected (depth first)
- This can be helpful in calculating total row counts that must include subRows
-`totalColumnsWidth: Int`
- This is the total width of all visible columns (only available when using non-table-element layouts)
- This function can be used to retrieve all necessary props to be placed on an `<input type='checkbox'>` component that will control the visibility of all columns
### HeaderGroup Properties
The following additional properties are available on every `headerGroup` object returned by the table instance.
-`headers: Array<Column>`
- **Required**
- The columns in this header group.
-`getHeaderGroupProps: Function(?props)`
- **Required**
- This function is used to resolve any props needed for this header group's row.
- You can use the `getHeaderGroupProps` hook to extend its functionality.
- Custom props may be passed. **NOTE: Custom props will override built-in table props, so be careful!**
-`getFooterGroupProps: Function(?props)`
- **Required**
- This function is used to resolve any props needed for this header group's footer row.
- You can use the `getFooterGroupProps` hook to extend its functionality.
- Custom props may be passed. **NOTE: Custom props will override built-in table props, so be careful!**
### Column Properties
The following properties are available on every `Column` object returned by the table instance.
-`id: String`
- The resolved column ID from either the column's `accessor` or the column's hard-coded `id` property
-`isVisible: Boolean`
- Whether the column should be currently visible or not.
- Columns that are not visible are still used for sorting, filtering, etc.
-`render: Function(type: String | Function | Component, ?props)`
- This function is used to render content with the added context of a column.
- The entire table `instance` will be passed to the renderer with the addition of a `column` property, containing a reference to the column
- If `type` is a string, will render using the `column[type]` renderer. React Table ships with default `Header` and `Footer` renderers. Other renderers like `Filter` and `Aggregated` are available via plugin hooks.
- If a function or component is passed instead of a string, it will be be passed the table instance and column model as props and is expected to return any valid JSX.
-`totalLeft: Int`
- This is the total width in pixels of all columns to the left of this column
- Specifically useful when using plugin hooks that allow the user to resize column widths
-`totalWidth: Int`
- This is the total width in pixels for this column (if it is a leaf-column) or or all of it's sub-columns (if it is a column group)
- Specifically useful when using plugin hooks that allow the user to resize column widths
-`getHeaderProps: Function(?props)`
- **Required**
- This function is used to resolve any props needed for this column's header cell.
- You can use the `getHeaderProps` hook to extend its functionality.
- Custom props may be passed. **NOTE: Custom props will override built-in table props, so be careful!**
-`getFooterProps: Function(?props)`
- **Required**
- This function is used to resolve any props needed for this column's footer cell.
- You can use the `getFooterProps` hook to extend its functionality.
- Custom props may be passed. **NOTE: Custom props will override built-in table props, so be careful!**
- This function can be used to retrieve all necessary props to be placed on an `<input type='checkbox'>` component that will control the visibility of this column.
### Row Properties
The following additional properties are available on every `row` object returned by the table instance.
-`cells: Array<Cell>`
- An array of visible `Cell` objects containing properties and functions specific to the row and column it belongs to.
- These cells are normally intended for display
- See [Cell Properties](#cell-properties) for more information
-`allCells: Array<Cell>`
- An array of all `Cell` objects containing properties and functions specific to the row and column it belongs to.
- Not every cell contained here is guaranteed that it should be displayed and is made available here for convenience and advanced templating purposes.
- See [Cell Properties](#cell-properties) for more information
-`values: Object<columnId: any>`
- A map of this row's **resolved** values by columnId, eg. `{ firstName: 'Tanner', lastName: 'Linsley' }`
-`getRowProps: Function(?props)`
- **Required**
- This function is used to resolve any props needed for this row.
- You can use the `getRowProps` hook to extend its functionality.
- Custom props may be passed. **NOTE: Custom props will override built-in table props, so be careful!**
-`index: Int`
- The index of the original row in the `data` array that was passed to `useTable`. If this row is a subRow, it is the original index within the parent row's subRows array
-`original: Object`
- The original row object from the `data` array that was used to materialize this row.
-`subRows: Array<Row>`
- If subRows were detect on the original data object, this will be an array of those materialized row objects.
-`state: Object`
- The current state of the row. It's lifespan is attached to that of the original `data` array. When the raw `data` is changed, this state value is reset to the row's initial value (using the `initialRowStateKey` option).
- Can be updated via `instance.setRowState` or the row's `setState` function.
### Cell Properties
The following additional properties are available on every `Cell` object returned in an array of `cells` on every row object.
-`column: Column`
- The corresponding column object for this cell
-`row: Row`
- The corresponding row object for this cell
-`value: any`
- The **resolved** value for this cell.
- By default, this value is displayed on the table via the default `Cell` renderer. To override the way a cell displays
-`getCellProps: Function(?props)`
- **Required**
- This function is used to resolve any props needed for this cell.
- You can use the `getCellProps` hook to extend its functionality.
- Custom props may be passed. **NOTE: Custom props will override built-in table props, so be careful!**
-`render: Function(type: String | Function | Component, ?props)`
- **Required**
- This function is used to render content with the added context of a cell.
- The entire table `instance` will be passed to the renderer with the addition of `column`, `row` and `cell` properties, containing a reference to each respective item.
- If `type` is a string, will render using the `column[type]` renderer. React Table ships with a default `Cell` renderer. Other renderers like `Aggregated` are available via hooks like `useFilters`.
- If a function or component is passed instead of a string, it will be be passed the table instance and cell model as props and is expected to return any valid JSX.
`useTokenPagination` is the hook that **aids in implementing row pagination using tokens**. It is useful for server-side pagination implementations that use **tokens** instead of page index. For more information on pagination, see Pagination
React Table is a headless utility, which means out of the box, it doesn't render or supply any actual UI elements. You are in charge of utilizing the state and callbacks of the hooks provided by this library to render your own table markup. [Read this article to understand why React Table is built this way](https://www.merrickchristensen.com/articles/headless-user-interface-components/). If you don't want to, then here's a quick rundown anyway:
- Separation of Concerns - Not that superficial kind you read about all the time. The real kind. React Table as a library honestly has no business being in charge of your UI. The look, feel, and overall experience of your table is what makes your app or product great. The less React Table gets in the way of that, the better!
- Maintenance - By removing the massive (and seemingly endless) API surface area required to support every UI use-case, React Table can remain small, easy-to-use and simple to update/maintain.
- Extensibility - UI presents countless edge cases for a library simply because it's a creative medium, and one where every developer does things differently. By not dictating UI concerns, React Table empowers the developer to design and extend the UI based on their unique use-case.
## The React Table instance
At the heart of every React Table is the `useTable` hook and the table `instance` object that it returns. This `instance` object contains everything you'll ever need to build a table and interact with its state. This includes, but is not limited to:
- Columns
- Materialized Data
- Sorting
- Filtering
- Grouping
- Pagination
- Expanded State
- Any functionality provided by custom plugin hooks, too!
## Rendering your own UI
As of React Table v7, **you the developer** are responsible for rendering your own UI, but don't let that intimidate you! Table UIs are fun and React Table makes it so easy to wire up your own table UI. The easiest way to learn how to build your own table UI is to [see some existing React Table examples](./examples)!
---
After reading about React Table's concepts, you should:
- [**Simple**](./examples/simple) - All of these examples use automatic state management, meaning, they don't hoist any state out of the table or manually control anything. Start here for understanding the basics about how to build your table UI.
- [**Complex**](./examples/complex) - These examples are more advanced because they demonstrate how to manually control and respond to the state of the table.
- [**Controlled**](./examples/controlled) - These examples are more advanced because they demonstrate how to manually control and respond to the state of the table.
- [**UI & Rendering**](./examples/ui) - These examples demonstrate how to use React Table with your favorite UI libraries or tools!
* Want to add another example? [Submit a PR!](https://github.com/tannerlinsley/react-table/compare)
All of these examples use automatic state management, meaning, they don't hoist any state out of the table or manually control anything. Start here for understanding the basics about how to build your table UI.
Below are some of the most frequently asked questions on how to use the React Table API to solve various table challenges you may encounter
<hr/>
## How can I manually control the table state?
Occasionally, you may need to override some of the table state from a parent component or from somewhere above the usage of `useTable`. In this case, you can turn to `useTable`'s `useControlledState` option. This hook function is run on every render and allows you an opportunity to override or change the final table state in a safe way.
For example, to control a table's `pageIndex` from a parent component:
> **It's important that the state override is done within a `useMemo` call to prevent the state variable from changing on every render. It's also extremely important that you always use the `state` in any dependencies to ensure that you do not block normal state updates.**
## How can I use the table state to fetch new data?
When managing your data externally or asynchronously (eg. server-side pagination/sorting/grouping/etc), you will need to fetch new data as the internal table state changes. With React Hooks, this is fantastically easier than it was before now that we have the `React.useEffect` hook. We can use this hook to "watch" the table state for specific changes and use those effects to trigger fetches for new data (or synchronize any other state you may be managing externally from your table component):
```js
functionTable({data,onFetchData}){
const{
state:{pageIndex,pageSize,sortBy,filters},
}=useTable({
data,
})
// When these table states change, fetch new data!
Using this approach, you can respond and trigger any type of side-effect using the table instance!
## How can I debounce rapid table state changes?
React Table has a few built-in side-effects of it's own (most of which are meant for resetting parts of the state when `data` changes). By default, these state side-effects are on and when their conditions are met, they immediately fire off actions that will manipulate the table state. Sometimes, this may result in multiple rapid rerenders (usually just 2, or one more than normal), and could cause any side-effects you have watching the table state to also fire multiple times in-a-row. To alleviate this edge-case, React Table exports a `useAsyncDebounce` function that will allow you to debounce rapid side-effects and only use the latest one.
A good example of this when doing server-side pagination and sorting, a user changes the `sortBy` for a table and the `pageIndex` is automatically reset to `0` via an internal side effect. This would normally cause our effect below to fire 2 times, but with `useAsyncDebounce` we can make sure our data fetch function only gets called once:
## How do I stop my table state from automatically resetting when my data changes?
Most plugins use state that _should_ normally reset when the data sources changes, but sometimes you need to suppress that from happening if you are filtering your data externally, or immutably editing your data while looking at it, or simply doing anything external with your data that you don't want to trigger a piece of table state to reset automatically.
For those situations, each plugin provides a way to disable the state from automatically resetting internally when data or other dependencies for a piece of state change. By setting any of them to `false`, you can stop the automatic resets from being triggered.
Here is an example of stopping basically every piece of state from changing as they normally do while we edit the `data` source for a table:
```js
const[data,setData]=React.useState([])
constskipPageResetRef=React.useRef()
constupdateData=newData=>{
// When data gets updated with this function, set a flag
// to disable all of the auto resetting
skipPageResetRef.current=true
setData(newData)
}
React.useEffect(()=>{
// After the table has updated, always remove the flag
skipPageResetRef.current=false
})
useTable({
...
autoResetPage:!skipPageResetRef.current,
autoResetExpanded:!skipPageResetRef.current,
autoResetGroupBy:!skipPageResetRef.current,
autoResetSelectedRows:!skipPageResetRef.current,
autoResetSortBy:!skipPageResetRef.current,
autoResetFilters:!skipPageResetRef.current,
autoResetRowState:!skipPageResetRef.current,
})
```
Now, when we update our data, the above table states will not automatically reset!
As explained in the [Concepts](./concepts) document, react-table is a headless tool, meaning you'll have to build your own UI. We recognize this can be potentially daunting, so here's a very basic table to start with.
## Define Row Shape
When thinking about a table, you typically have a number of rows split into a number of columns. While table configurations can get far more complex with nested columns, subrows, etc. for this basic quick start, we need to define some data. Note that this data must be defined using [`React.useMemo`](https://reactjs.org/docs/hooks-reference.html#usememo) in order to take advantage of the power of memoization.
```javascript
const data = React.useMemo(
() => [
{
col1: 'Hello',
col2: 'World',
},
{
col1: 'react-table',
col2: 'rocks',
},
{
col1: 'whatever',
col2: 'you want',
},
],
[]
)
```
## Define Columns
The first step to using react-table is to create a set of column definitions to pass into the `useTable` hook. These columns must be defined using `React.useMemo` in order to take advantage of the power of memoization.
```javascript
const columns = React.useMemo(
() => [
{
Header: 'Column 1',
accessor: 'col1', // accessor is the "key" in the data
},
{
Header: 'Column 2',
accessor: 'col2',
},
],
[]
)
```
## Implement `useTable` hook
Now that you have the basic `columns` and `data` defined, you can pass those into `useTable` and retrieve the properties you need.
```javascript
const {
getTableProps,
getTableBodyProps,
headerGroups,
rows,
prepareRow,
} = useTable({ columns, data })
```
If you're new to JavaScript (especially ES2015+), this syntax may look a little strange. The lefthand side of the assigment is using [object destructuring](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) to extract the properties we need that are returned from the `useTable` hook (or function). On the right hand side, at a minimum, `useTable` needs to be provided with an object containing the memoized columns and data that we created above.
## Build a basic UI structure
OK, so that's great, we've implemented the hook, but we still don't have a table to show, right? Let's use the properties returned from `useTable` to build a basic table structure.
Again, if you're relatively new to JavaScript (or ES2015+ syntax), you may wonder, "What is with all the ...s?". This is the [spread syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) that _spreads_ all properties of an object (or array) without having to manually extract them all. So, with the first row, `<table {...getRowProps()}>` will return a `table` element with all of the properties returned by `getTableProps()`.
## Final Result
If we put all of this together, we should get a very basic (boring) table. (_Styles added just to make it a little more attractive..._)
_The following example is a live component, so as you make changes in the code, it should update the table at the top._
import { Playground } from 'docz'
import { useTable } from '../src/hooks/useTable'
<Playground>
{() => {
const data = React.useMemo(
() => [
{
col1: 'Hello',
col2: 'World',
},
{
col1: 'react-table',
col2: 'rocks',
},
{
col1: 'whatever',
col2: 'you want',
},
],
[]
)
const columns = React.useMemo(
() => [
{
Header: 'Column 1',
accessor: 'col1', // accessor is the "key" in the data
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.