table icon indicating copy to clipboard operation
table copied to clipboard

Manual server side pagination with rows selection

Open shamelio opened this issue 6 months ago • 0 comments

TanStack Table version

8.5.11

Framework/Library version

react 18

Describe the bug and the steps to reproduce it

Hi,

I'm encounter issue when using row selection with manual server side pagination. My issue is related to the header checkbox.

Let's say we have 2 pages, 10 rows in each page and 14 total rows. It means the first page has 10 rows and second has 4 rows.

Scenario 1 - Select 3 rows on the first page. Move to the next page. The header checkbox is indeterminate.

Scenario 2 - Select 4 rows on the first page. Move to the next page. The header checkbox is unchecked.

Looks like the issue is in getIsSomeRowsSelected where it's comparing total selected rows with table.getFilteredRowModel().flatRows.length which is the total page's row count on manual pagination.

I was managed to reproduced the issue using query router param example while adding selections features from row selection example.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://stackblitz.com/edit/react-v6yfaiij?file=src%2Fcomponents%2FBasicTable.js

Screenshots or Videos (Optional)

https://github.com/user-attachments/assets/3fd218e6-63a6-4d6a-8b83-39cc0d38d836

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.

shamelio avatar Jun 17 '25 12:06 shamelio