File tree 1 file changed +5
-3
lines changed
packages/table-core/src/features
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ export interface RowSelectionRow {
97
97
* @link [API Docs](https://tanstack.com/table/v8/docs/api/features/row-selection#toggleselected)
98
98
* @link [Guide](https://tanstack.com/table/v8/docs/guide/row-selection)
99
99
*/
100
- toggleSelected : ( value ?: boolean ) => void
100
+ toggleSelected : ( value ?: boolean , opts ?: { selectChildren ?: boolean } ) => void
101
101
}
102
102
103
103
export interface RowSelectionInstance < TData extends RowData > {
@@ -475,7 +475,7 @@ export const RowSelection: TableFeature = {
475
475
row : Row < TData > ,
476
476
table : Table < TData >
477
477
) : void => {
478
- row . toggleSelected = value => {
478
+ row . toggleSelected = ( value , opts ) => {
479
479
const isSelected = row . getIsSelected ( )
480
480
481
481
table . setRowSelection ( old => {
@@ -487,7 +487,9 @@ export const RowSelection: TableFeature = {
487
487
488
488
const selectedRowIds = { ...old }
489
489
490
- mutateRowIsSelected ( selectedRowIds , row . id , value , table )
490
+ if ( opts ?. selectChildren ?? true ) {
491
+ mutateRowIsSelected ( selectedRowIds , row . id , value , table )
492
+ }
491
493
492
494
return selectedRowIds
493
495
} )
You can’t perform that action at this time.
0 commit comments