table icon indicating copy to clipboard operation
table copied to clipboard

Table v8 expanding - incorrect state of parent checkbox when selecting subrows

Open odini85 opened this issue 1 year ago • 1 comments

TanStack Table version

8.17.3

Framework/Library version

18.2.0

Describe the bug and the steps to reproduce it

The closed issue #4720 has potential bugs.

It can be verified according to the following steps.

1. Apply the code guided in issue #4720 to the sample code below:

https://tanstack.com/table/v8/docs/framework/react/examples/expanding

<IndeterminateCheckbox {...{ checked: row.getIsSelected() || row.getIsAllSubRowsSelected(), indeterminate: row.getIsSomeSelected(), onChange: row.getToggleSelectedHandler(), }} />

2. Implement this guided sample code into the sample code and conduct tests.

3. The potential bugs identified are as follows:

if the parent is checked and all children are checked, unchecking one child does not change the status of the parent checkbox.

https://github.com/TanStack/table/assets/29395995/fb14a72b-cce2-4a38-b3d6-218c00809581

If all children are individually checked, the parent's checkbox status changes to checked. However, if the parent checkbox is then unchecked, it does not uncheck all the children.

https://github.com/TanStack/table/assets/29395995/06470539-9371-43c2-b301-ddfcb178066b

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/devbox/jolly-nightingale-k9tx7h

Screenshots or Videos (Optional)

  • https://github.com/TanStack/table/assets/29395995/fb14a72b-cce2-4a38-b3d6-218c00809581
  • https://github.com/TanStack/table/assets/29395995/06470539-9371-43c2-b301-ddfcb178066b

Do you intend to try to help solve this bug with your own PR?

None

Terms & Code of Conduct

  • [X] I agree to follow this project's Code of Conduct
  • [X] I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

odini85 avatar Jun 20 '24 23:06 odini85

Does anyone have some workaround?

Pukowka avatar Jul 22 '24 10:07 Pukowka

Up

wellingtonngallo avatar Nov 11 '24 15:11 wellingtonngallo

@odini85 you solve this?

wellingtonngallo avatar Nov 11 '24 15:11 wellingtonngallo