swimlane / ngx-datatable

✨ A feature-rich yet lightweight data-table crafted for Angular
http://swimlane.github.io/ngx-datatable/
MIT License
4.63k stars 1.68k forks source link

Sorting has no effect when used with row grouping #1064

Open idpaterson opened 7 years ago

idpaterson commented 7 years ago

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior Sorting specified with the sorts input or modified by clicking a column header is ignored when using groupRowsBy.

I attempted a workaround to null out groupRowsBy but while the group headers went away it did not fix the sort. In my case, it is possible to pre-sort the data before providing to rows so that groups are displayed in the correct order.

Expected behavior Sorting should do something though the exact behavior requires discussion. I expected sorts to affect the order of groups and rows within those groups such that a primary sort on the group and secondary sort on the items in the group would result in sorted groups containing sorted items.

However, I don't have a clear expectation for further sorting by the user. In my case it would be appropriate to either remove the groups once sorted on a different column, or maintain the group order but apply the selected sort within each group.

Reproduction of the problem The Row Grouping example exhibits this behavior; clicking a column does not affect the data, it just re-expands all groups.

groupsort

What is the motivation / use case for changing the behavior? It seems that all other features support sorting, so I chose to classify this as a bug.

Please tell us about your environment: macOS, Atom, npm 5

dariobraun commented 3 years ago

Any chance this will be implemented? The absence of this feature is unfortunately a deal breaker in my case.

MateusSilva0101 commented 1 month ago

Any solution for this case?