You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a problem about how to implement a need about if all subrows were selected/unselected, their parent row(simply row) could also be selected/unselected automatically, this behavior will not stop until top layer row (bubble up). and the state of rowSelection could contain all of them.
solution
after read some row APIs, I found a indirect way to implement this, here is the example, and the example is modified from expand example.
how i implement it is do some extra thing in checkbox click hanlder and a extra state and useEffect to update RowSelection state.
analyze
I don't think this is a good solution.
For the selection feature, based on some related issues (#4720#4759#4878#4879) in this repository, the source code of table-core, and my understanding, up to now, two demands regarding the selection of parent-child rows have been identified:
Whether the state of a row will or will not change the selection state of its subrows (already implemented in table-core).
Whether the selection state of subrows will or will not change the selection state of the row, and whether the rowSelection state could contain all of them or only leaf rows.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
problem description
I have a problem about how to implement a need about if all subrows were selected/unselected, their parent row(simply row) could also be selected/unselected automatically, this behavior will not stop until top layer row (bubble up). and the state of
rowSelection
could contain all of them.solution
after read some row APIs, I found a indirect way to implement this, here is the example, and the example is modified from expand example.
https://codesandbox.io/p/devbox/father-child-select-kc7wrz
how i implement it is do some extra thing in checkbox click hanlder and a extra
state
anduseEffect
to update RowSelection state.analyze
I don't think this is a good solution.
For the selection feature, based on some related issues (#4720 #4759 #4878 #4879) in this repository, the source code of table-core, and my understanding, up to now, two demands regarding the selection of parent-child rows have been identified:
for 1, because of
opts.selectChildren
:developer can use
toggleSelected
to change the state of rowSelection.for 2, nothing supply.
I prefer to add a
selectParent
inopt
main...Xxs-7:table:fix-RowSelection-state-parentRow
Beta Was this translation helpful? Give feedback.
All reactions