MCPcopy Index your code
hub / github.com/TanStack/table / isSubRowSelected

Function isSubRowSelected

packages/table-core/src/features/RowSelection.ts:629–668  ·  view source on GitHub ↗
(
  row: Row<TData>,
  selection: Record<string, boolean>,
  table: Table<TData>
)

Source from the content-addressed store, hash-verified

627}
628
629export function isSubRowSelected<TData extends RowData>(
630 row: Row<TData>,
631 selection: Record<string, boolean>,
632 table: Table<TData>
633): boolean | 'some' | 'all' {
634 if (!row.subRows?.length) return false
635
636 let allChildrenSelected = true
637 let someSelected = false
638
639 row.subRows.forEach(subRow => {
640 // Bail out early if we know both of these
641 if (someSelected && !allChildrenSelected) {
642 return
643 }
644
645 if (subRow.getCanSelect()) {
646 if (isRowSelected(subRow, selection)) {
647 someSelected = true
648 } else {
649 allChildrenSelected = false
650 }
651 }
652
653 // Check row selection of nested subrows
654 if (subRow.subRows && subRow.subRows.length) {
655 const subRowChildrenSelected = isSubRowSelected(subRow, selection, table)
656 if (subRowChildrenSelected === 'all') {
657 someSelected = true
658 } else if (subRowChildrenSelected === 'some') {
659 someSelected = true
660 allChildrenSelected = false
661 } else {
662 allChildrenSelected = false
663 }
664 }
665 })
666
667 return allChildrenSelected ? 'all' : someSelected ? 'some' : false
668}

Callers 1

RowSelection.tsFile · 0.85

Calls 1

isRowSelectedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…