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.
v6 is now considered feature complete to its current abilities and limitations. We are not actively working to fix any issues for v6 any more. We will, however, merge any non-breaking pull requests submitted to fix anything in v6.
# Using v7?
Thanks for using the beta version of React Table v7! We're very excited about it.
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Codesandbox!**
Use a new [react-table codesandbox](https://codesandbox.io/s/m5lxzzpz69) to reproduce the issue.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
We do not track feature requests through Github. Please use the [Spectrum React Table Forum](https://spectrum.chat/react-table) to talk about new ideas and features.
We do not use Github to track general support. Please use our public support forum at https://spectrum.chat/react-table.
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!
- 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 [Spectrum.chat/react-table](https://spectrum.chat/react-table) **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 [Spectrum.chat/react-table](https://spectrum.chat/react-table)
## 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
- 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,
collapseOnSortingChange:false,
collapseOnPageChange:true,
freezeWhenExpanded:false,
defaultSorting:[],
// 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:()=>({}),
getTfootProps:()=>({}),
getTfootTrProps:()=>({}),
getTfootThProps:()=>({}),
getPaginationProps:()=>({}),
getLoadingProps:()=>({}),
getNoDataProps:()=>({}),
// Global Column Defaults
column:{
sortable:true,
show:true,
minWidth:100,
// Cells only
render:undefined,
className:'',
style:{},
getProps:()=>({}),
// Headers only
header:undefined,
headerClassName:'',
headerStyle:{},
getHeaderProps:()=>({})
// Footers only
footer:undefined,
footerClassName:'',
footerStyle:{},
getFooterProps:()=>({})
},
// Text
previousText:'Previous',
nextText:'Next',
loadingText:'Loading...',
noDataText:'No rows found',
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
```javascript
[{
// General
accessor:'propertyName'// or Accessor eg. (row) => row.propertyName (see "Accessors" section for more details)
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,
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', a function that returns a primitive, or JSX / React Component 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
getHeaderProps: (state, rowInfo, column, instance) => ({}) // a function that returns props to decorate the `th` element of the column
// Header Groups only
columns: [...] // See Header Groups section below
// Footer
footer: 'HeaderName' or JSX eg. ({data, column}) => <div>Header Name</div>,
footerClassName: '', // Set the classname of the `td` element of the column'sfooter
footerStyle:{},// Set the style of the `td` element of the column's footer
getFooterProps:(state,rowInfo,column,instance)=>({})// a function that returns props to decorate the `td` element of the column's footer
}]
```
## Accessors
Accessors are functions that return the value to populate the row's value for the column.
This lets the render function not have to worry about accessing the correct data, the value is automatically populated in it's props.
If a `string` or `array` is passed the default accessor is used.
The default accessor will parse the input into an array and recursively flatten it.
Any values that contain a dot (`.`) will be split.
Any values that contain bracket (`[]`) will be split.
This array is then used as the path to the value to return.
("$" is the placeholder value that would be returned by the default accessor)
If your data has a field/key with a dot (`.`) you will need to supply a custom accessor.
## 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.
You can use any react component or JSX to display content in column headers, cells and footers. Any component you use will be passed the following props (if available):
-`row` - Original row from your data
-`rowValues` - The post-accessed values from the original row
-`index` - The index of the row
-`viewIndex` - the index of the row relative to the current page
-`level` - The nesting depth (zero-indexed)
-`nestingPath` - The nesting path of the row
-`aggregated` - A boolean stating if the row is an aggregation row
-`subRows` - An array of any expandable sub-rows contained in this row
```javascript
// This column uses a stateless component to produce a different colored bar depending on the value
// You can also use stateful components or any other function that returns JSX
- React-table ships with a minimal and clean stylesheet to get you on your feet quickly.
- The stylesheet is located at `react-table/react-table.css`.
- There are countless ways to import a stylesheet. If you have questions on how to do so, consult the documentation of your build system.
#### Classes
- 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
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 supports `classname` and `style` props.
## 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 and 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 components and state for custom render logic. The easiest way to do this is to pass a function as the child of `<ReactTable />`.
The function you pass will be called with the following items:
- Fully-resolved state of the table
- A function that returns the standard table component
- 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 without a `ref`
- Decorating the table or extending it with your own UI
- Building your own custom display logic
Accessing internal state and wrapping with more UI:
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,
TfootComponent:component,
ExpanderComponent:component,
PaginationComponent:component,
PreviousComponent:undefined,
NextComponent:undefined,
LoadingComponent:component,
NoDataComponent: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 (4kb - 9kb depending on features 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
-<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
## News / Q&A
#### What is the current state of React Table?
React Table v7 is still under active development, and its API is still changing, albeit only slightly. For this reason, it is currently in an **beta** release state. It's estimated that it will be fully released as a stable version sometime during October 2019.
#### Should I use v7@beta in production?
You can use it in production as long as you lock in the beta version in your package.json and also accept that there may be unlikely, but possible bug fixes and/or API changes before it's official release.
#### I'm still using v6, what should I do?
v6 is a great library and is still the default install for `react-table`, however, I do not intend on 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.
## Documentation
- [Installation](./docs/installation.md) - Walk through how to install React Table
- [Concepts](./docs/concepts.md) - Read how React Table works and how you can use it better
- [Examples](./docs/examples.md) - Experience and learn from some examples and guides of how to use React Table and implement common patterns
- [API](./docs/api.md) - Get to know React Table's API, how to use it and how to extend its functionality
- [Contributing](./CONTRIBUTING.md) - Become familiar with how to contribute back to React Table
- [Code of Conduct](./CODE_OF_CONDUCT.md) - Be a good React Table citizen by following these repository rules
## Sponsors
**React Table v7** is being built and maintained by me, @tannerlinsley and I am always in need of more Patreon support to keep this project afloat. If you would like to contribute to my Patreon goal for v7 and beyond, [visit my Patreon and help me out!](https://patreon.com/tannerlinsley)
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
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.