Grouped rows sort to the bottom after running `column.clearSorting()`
Howdy!
I'm working on a table using this library in SvelteKit. I'm really enjoying it!
To make my table, I'm iterating over
flatRows
instead of traversing through the nested rows
tree. I like this because it's simpler and it makes it easier for me to write logic to render the table whether it's grouped or ungrouped.
I've run into an issue while testing my work today, and I noticed that if I:
- group on a column, then
- sort on another column (column.toggleSort(true/false)
), then
- clear the sorting for that column (column.clearSorting()
)
The grouped rows (flatRow.getIsGrouped() === true
) are sorting to the bottom of the flatRows
array, and all of the data (flatRow.getIdGrouped() === false
) rows get duplicated. So if I have 10 records before grouping, then 12 after grouping (+2 group rows), I'll have 22 (10 * 2 + 2) rows in total in table.getRowModel().flatRows
- again with the group rows sorted to the bottom. The table.getRowModel().rows
field looks to be sorted correctly.
Has anyone else seen this before? Any ideas on how to overcome this aside from ditching flatRows
? I could ditch flatRows
, I'd just rather not is all.0 Replies