Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/framework/angular/guide/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,19 @@ Some row APIs have changed from private to public:
|----|-----|
| `row._getAllCellsByColumnId()` (private) | `row.getAllCellsByColumnId()` (public) |

### Row Selection API Changes

The "some rows selected" checks were simplified to mean "at least one row is selected":

| API | v8 | v9 |
|-----|-----|-----|
| `table.getIsSomeRowsSelected()` | `true` when some but not all rows are selected | `true` when at least one row is selected |
| `table.getIsSomePageRowsSelected()` | `true` when some but not all page rows are selected | `true` when at least one page row is selected |

In v8 these returned `false` once every row was selected; in v9 they stay `true`. If you use them to drive an indeterminate "select all" checkbox, gate the indeterminate state on the matching all-selected check so it clears at full selection:

`getIsSomeRowsSelected() && !getIsAllRowsSelected()`

Comment thread
KevinVandy marked this conversation as resolved.
---

## TypeScript Changes Summary
Expand Down
13 changes: 13 additions & 0 deletions docs/framework/lit/guide/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,19 @@ const features = tableFeatures({

Underscore-prefixed APIs that are now public should be called without `_`, such as `row.getAllCellsByColumnId()`.

### Row Selection API Changes

The "some rows selected" checks were simplified to mean "at least one row is selected":

| API | v8 | v9 |
|-----|-----|-----|
| `table.getIsSomeRowsSelected()` | `true` when some but not all rows are selected | `true` when at least one row is selected |
| `table.getIsSomePageRowsSelected()` | `true` when some but not all page rows are selected | `true` when at least one page row is selected |

In v8 these returned `false` once every row was selected; in v9 they stay `true`. If you use them to drive an indeterminate "select all" checkbox, gate the indeterminate state on the matching all-selected check so it clears at full selection:

`getIsSomeRowsSelected() && !getIsAllRowsSelected()`

---

## TypeScript Changes Summary
Expand Down
13 changes: 13 additions & 0 deletions docs/framework/preact/guide/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,19 @@ const features = tableFeatures({

Several underscore-prefixed APIs are now public without the underscore. For example, `row._getAllCellsByColumnId()` becomes `row.getAllCellsByColumnId()`.

### Row Selection API Changes

The "some rows selected" checks were simplified to mean "at least one row is selected":

| API | v8 | v9 |
|-----|-----|-----|
| `table.getIsSomeRowsSelected()` | `true` when some but not all rows are selected | `true` when at least one row is selected |
| `table.getIsSomePageRowsSelected()` | `true` when some but not all page rows are selected | `true` when at least one page row is selected |

In v8 these returned `false` once every row was selected; in v9 they stay `true`. If you use them to drive an indeterminate "select all" checkbox, gate the indeterminate state on the matching all-selected check so it clears at full selection:

`getIsSomeRowsSelected() && !getIsAllRowsSelected()`

---

## TypeScript Changes Summary
Expand Down
13 changes: 13 additions & 0 deletions docs/framework/react/guide/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,19 @@ Some row APIs have changed from private to public:

If you were accessing this internal API, you can now use it without the underscore prefix.

### Row Selection API Changes

The "some rows selected" checks were simplified to mean "at least one row is selected":

| API | v8 | v9 |
|-----|-----|-----|
| `table.getIsSomeRowsSelected()` | `true` when some but not all rows are selected | `true` when at least one row is selected |
| `table.getIsSomePageRowsSelected()` | `true` when some but not all page rows are selected | `true` when at least one page row is selected |

In v8 these returned `false` once every row was selected; in v9 they stay `true`. If you use them to drive an indeterminate "select all" checkbox, gate the indeterminate state on the matching all-selected check so it clears at full selection:

`getIsSomeRowsSelected() && !getIsAllRowsSelected()`

---

## TypeScript Changes Summary
Expand Down
13 changes: 13 additions & 0 deletions docs/framework/solid/guide/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,19 @@ const features = tableFeatures({

Underscore-prefixed APIs that are now public should be called without `_`, such as `row.getAllCellsByColumnId()`.

### Row Selection API Changes

The "some rows selected" checks were simplified to mean "at least one row is selected":

| API | v8 | v9 |
|-----|-----|-----|
| `table.getIsSomeRowsSelected()` | `true` when some but not all rows are selected | `true` when at least one row is selected |
| `table.getIsSomePageRowsSelected()` | `true` when some but not all page rows are selected | `true` when at least one page row is selected |

In v8 these returned `false` once every row was selected; in v9 they stay `true`. If you use them to drive an indeterminate "select all" checkbox, gate the indeterminate state on the matching all-selected check so it clears at full selection:

`getIsSomeRowsSelected() && !getIsAllRowsSelected()`

---

## TypeScript Changes Summary
Expand Down
13 changes: 13 additions & 0 deletions docs/framework/svelte/guide/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,19 @@ const features = tableFeatures({

Underscore-prefixed APIs that are now public should be called without `_`, such as `row.getAllCellsByColumnId()`.

### Row Selection API Changes

The "some rows selected" checks were simplified to mean "at least one row is selected":

| API | v8 | v9 |
|-----|-----|-----|
| `table.getIsSomeRowsSelected()` | `true` when some but not all rows are selected | `true` when at least one row is selected |
| `table.getIsSomePageRowsSelected()` | `true` when some but not all page rows are selected | `true` when at least one page row is selected |

In v8 these returned `false` once every row was selected; in v9 they stay `true`. If you use them to drive an indeterminate "select all" checkbox, gate the indeterminate state on the matching all-selected check so it clears at full selection:

`getIsSomeRowsSelected() && !getIsAllRowsSelected()`

---

## TypeScript Changes Summary
Expand Down
13 changes: 13 additions & 0 deletions docs/framework/vue/guide/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,19 @@ const features = tableFeatures({

Underscore-prefixed APIs that are now public should be called without `_`, such as `row.getAllCellsByColumnId()`.

### Row Selection API Changes

The "some rows selected" checks were simplified to mean "at least one row is selected":

| API | v8 | v9 |
|-----|-----|-----|
| `table.getIsSomeRowsSelected()` | `true` when some but not all rows are selected | `true` when at least one row is selected |
| `table.getIsSomePageRowsSelected()` | `true` when some but not all page rows are selected | `true` when at least one page row is selected |

In v8 these returned `false` once every row was selected; in v9 they stay `true`. If you use them to drive an indeterminate "select all" checkbox, gate the indeterminate state on the matching all-selected check so it clears at full selection:

`getIsSomeRowsSelected() && !getIsAllRowsSelected()`

---

## TypeScript Changes Summary
Expand Down
6 changes: 4 additions & 2 deletions examples/react/row-selection/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,10 @@ function App() {
</button>
</div>
<div>
<label>Row Selection State:</label>
<pre>{JSON.stringify(table.state, null, 2)}</pre>
<label>State:</label>
<pre>
{data.length < 1_001 && JSON.stringify(table.state, null, 2)}
</pre>
</div>
</div>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
table_getIsSomePageRowsSelected,
table_getIsSomeRowsSelected,
table_getPreSelectedRowModel,
table_getSelectedRowIds,
table_getSelectedRowModel,
table_getToggleAllPageRowsSelectedHandler,
table_getToggleAllRowsSelectedHandler,
Expand Down Expand Up @@ -88,10 +89,11 @@ export const rowSelectionFeature: TableFeature = {
fn: (defaultState) => table_resetRowSelection(table, defaultState),
},
table_toggleAllRowsSelected: {
fn: (value) => table_toggleAllRowsSelected(table, value),
fn: (value, opts) => table_toggleAllRowsSelected(table, value, opts),
},
table_toggleAllPageRowsSelected: {
fn: (value) => table_toggleAllPageRowsSelected(table, value),
fn: (value, opts) =>
table_toggleAllPageRowsSelected(table, value, opts),
},
table_getPreSelectedRowModel: {
fn: () => table_getPreSelectedRowModel(table),
Expand All @@ -117,17 +119,37 @@ export const rowSelectionFeature: TableFeature = {
table.getSortedRowModel(),
],
},
table_getSelectedRowIds: {
fn: () => table_getSelectedRowIds(table),
memoDeps: () => [table.atoms.rowSelection?.get()],
},
table_getIsAllRowsSelected: {
fn: () => table_getIsAllRowsSelected(table),
memoDeps: () => [
table.atoms.rowSelection?.get(),
table.getFilteredRowModel(),
table.options.enableRowSelection,
],
},
table_getIsAllPageRowsSelected: {
fn: () => table_getIsAllPageRowsSelected(table),
memoDeps: () => [
table.atoms.rowSelection?.get(),
table.getPaginatedRowModel(),
table.options.enableRowSelection,
],
},
table_getIsSomeRowsSelected: {
fn: () => table_getIsSomeRowsSelected(table),
memoDeps: () => [table.atoms.rowSelection?.get()],
},
table_getIsSomePageRowsSelected: {
fn: () => table_getIsSomePageRowsSelected(table),
memoDeps: () => [
table.atoms.rowSelection?.get(),
table.getPaginatedRowModel(),
table.options.enableRowSelection,
],
},
table_getToggleAllRowsSelectedHandler: {
fn: () => table_getToggleAllRowsSelectedHandler(table),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { TableFeatures } from '../../types/TableFeatures'
import type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'
import type { Row } from '../../types/Row'

export type RowSelectionState = Record<string, boolean | undefined>
export type RowSelectionState = Record<string, true>

export interface TableState_RowSelection {
rowSelection: RowSelectionState
Expand Down Expand Up @@ -98,6 +98,10 @@ export interface Table_RowSelection<
* Builds a selected-row model from rows after grouping.
*/
getGroupedSelectedRowModel: () => RowModel<TFeatures, TData>
/**
* Returns the ids of all selected rows.
*/
getSelectedRowIds: () => Array<string>
/**
* Checks whether every selectable row on the current page is selected.
*/
Expand Down Expand Up @@ -143,9 +147,15 @@ export interface Table_RowSelection<
/**
* Selects/deselects all rows on the current page.
*/
toggleAllPageRowsSelected: (value?: boolean) => void
toggleAllPageRowsSelected: (
value?: boolean,
opts?: { deselectAll?: boolean },
) => void
/**
* Selects/deselects all rows in the table.
*/
toggleAllRowsSelected: (value?: boolean) => void
toggleAllRowsSelected: (
value?: boolean,
opts?: { deselectAll?: boolean },
) => void
}
Loading
Loading