KevinVandy / mantine-react-table

A fully featured Mantine V5 implementation of TanStack React Table V8, forked from Material React Table
https://www.mantine-react-table.com/
MIT License
767 stars 133 forks source link

Grouping causes rows count to increase #325

Open misiek08 opened 2 months ago

misiek08 commented 2 months ago

mantine-react-table version

v1.3.4

react & react-dom versions

v17.0.2

Describe the bug and the steps to reproduce it

  1. Open https://www.mantine-react-table.com/docs/guides/aggregation-and-grouping#aggregation-grouping-example
  2. See 298 as row count in table.
  3. Remove grouping by state (default).
  4. Footer now says there are 250 rows.

For me this is a bug, because we have 250 rows of data in table and counting grouping rows is misleading. Let's assume orders table, where you group by client and now you have more orders than really were received.

// if this is accepted as a bug I can try to send PR fixing it. I didn't look into code yet.

Minimal, Reproducible Example - (Optional, but Recommended)

Official grouping/agg example at https://www.mantine-react-table.com/docs/guides/aggregation-and-grouping#aggregation-grouping-example

Screenshots or Videos (Optional)

No response

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

Maybe, I'll investigate and start debugging

Terms

misiek08 commented 1 month ago

I'm not sure, but probably something like getPrePaginationRowModel().flatRows.filter(r => !r.getIsGrouped()).length here could help.

Don't know if it's safe, will try to work with this in some spare time, but maybe this will help someone with more knowledge to push PR faster.