mirror of
https://github.com/gosticks/react-table.git
synced 2026-06-28 17:10:01 +00:00
Death of the path, fix some hooks, fix selectedRows
- 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
This commit is contained in:
@@ -9,12 +9,10 @@
|
||||
|
||||
The following options are supported via the main options object passed to `useTable(options)`
|
||||
|
||||
- `state.selectedRowPaths: Set<RowPathKey>`
|
||||
- `initialState.selectedRowIds: Set<RowPathKey>`
|
||||
- Optional
|
||||
- Defaults to `new Set()`
|
||||
- If a row's path key (eg. a row path of `[1, 3, 2]` would have a path key of `1.3.2`) is found in this array, it will have a selected state.
|
||||
- `initialState.selectedRowPaths`
|
||||
- Identical to the `state.selectedRowPaths` option above
|
||||
- If a row's ID is found in this array, it will have a selected state.
|
||||
- `manualRowSelectedKey: String`
|
||||
- Optional
|
||||
- Defaults to `isSelected`
|
||||
@@ -33,7 +31,7 @@ The following values are provided to the table `instance`:
|
||||
- `toggleRowSelected: Function(rowPath: String, ?set: Bool) => void`
|
||||
- Use this function to toggle a row's selected state.
|
||||
- Optionally pass `true` or `false` to set it to that state
|
||||
- `toggleRowSelectedAll: Function(?set: Bool) => void`
|
||||
- `toggleAllRowsSelected: Function(?set: Bool) => void`
|
||||
- Use this function to toggle all rows as select or not
|
||||
- Optionally pass `true` or `false` to set all rows to that state
|
||||
- `getToggleAllRowsSelectedProps: Function(props) => props`
|
||||
@@ -55,6 +53,8 @@ The following additional properties are available on every **prepared** `row` ob
|
||||
|
||||
- `isSelected: Bool`
|
||||
- Will be `true` if the row is currently selected
|
||||
- `isSomeSelected: Bool`
|
||||
- Will be `true` if the row has subRows and at least one of them is currently selected
|
||||
- `toggleRowSelected: Function(?set)`
|
||||
- Use this function to toggle this row's selected state.
|
||||
- Optionally pass `true` or `false` to set it to that state
|
||||
|
||||
Reference in New Issue
Block a user