DataTable: Grouping rows generate repeated groups
Describe the bug
When setting the groupRowsBy propety, it generate repeated groups.
Reproducer
https://stackblitz.com/edit/fxzaak?file=src%2FApp.jsx
PrimeReact version
10.6.6
React version
18.x
Language
TypeScript
Build / Runtime
Next.js
Browser(s)
Chrome 126
Steps to reproduce the behavior
- Click on the top bar "Agrupar por..." dropdown and choose "Activo"
Expected behavior
It should generate only two groups, one for "Activo" and "Inactivo".
@alvarorodriguezestruch Were you able to exact this issue for this or some hacky fix . I am getting the same issue in my data
Not sure if that is expected or not, but when grouping if you disable the pagination and sorts by the column you are grouping, is the only way I found to create unique groups
@alvarorodriguezestruch Thanks I will try the same. Is there any discord channel or somethings where maintainers can be contacted to check it its really a issue
There is a Discord channel it's posted right on the main PrimeReact GitHub page
However PrimeTek does not really monitor them it's for community members to support other community members.
@melloware Did you check by any chance if its an issue or not or if there is some prop passing issue ?
Reproducer (by @alvarorodriguezestruch ) https://stackblitz.com/edit/fxzaak?file=src%2FApp.jsx
I have only seen it work where the group by field has to be the same as it's sorted. So no property that I know of. So I am not sure if it is by design or not.
Just wanted to share how I worked around this bug.
As melloware mentioned I guess we need the data to be sorted by the field we are grouping by.
So in my case I had 6 objects and the groupByField was for scheduleType. Initially i had it this way: [0,1,1,0,1,0]
With that kind of data it would create duplicate groupings, But when I sorted it to have it this way: [0,0,0,1,1,1]
The duplicate groupings went away.