Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order by count in igx-grid group by #11642

Closed
Eralmidia opened this issue May 31, 2022 · 11 comments · Fixed by #12734
Closed

Order by count in igx-grid group by #11642

Eralmidia opened this issue May 31, 2022 · 11 comments · Fixed by #12734
Assignees
Labels
grid: groupby 🧰 feature-request ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.

Comments

@Eralmidia
Copy link

Eralmidia commented May 31, 2022

Is your feature request related to a problem? Please describe.

When using the group by feature, you can set the sorting direction to alphabetical asc og desc, but you can sort by the number of occurrences in each group.

Describe the solution you'd like

A new sort direction for count, or perhaps this could be default sorting if the sorting direction is set to None?
image

@ChronosSF
Copy link
Member

@Eralmidia , this can be achieved with a custom sorting strategy. Have you considered using the exposed extension points already available to implement it on application level?

@kdinev
Copy link
Member

kdinev commented Jun 2, 2022

@ChronosSF wouldn't a custom sorting strategy change the grouping though? In this case the sorting would have to be the same, but a way for sorting the actual group headers would have to be introduced? Or you're suggesting to sort additionally after the alphabetical sort by reordering the unique values by number of occurrences? Can you provide an example?

@ChronosSF
Copy link
Member

The custom strategy would sort twice - once to group the values into chunks then to get the chunks and sort them by size. Then you can leave grouping to group the result. My assumption is that any sorting on grouped columns would sort the groups by size so no extra UI is needed, but of course it can be wrong.

It's just a suggestion because barring the new UI, it can be achieved with the current feature set. If we are to release it as new functionality, it's unlikely the customer will get it this soon.

@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Aug 29, 2022
@dkamburov dkamburov removed the status: inactive Used to stale issues and pull requests label Aug 29, 2022
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Oct 29, 2022
@dkamburov dkamburov removed the status: inactive Used to stale issues and pull requests label Oct 31, 2022
@github-actions
Copy link

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Dec 31, 2022
@dkamburov dkamburov removed the status: inactive Used to stale issues and pull requests label Jan 3, 2023
@github-actions
Copy link

github-actions bot commented Mar 5, 2023

There has been no recent activity and this issue has been marked inactive.

@github-actions github-actions bot added the status: inactive Used to stale issues and pull requests label Mar 5, 2023
@dkamburov dkamburov removed the status: inactive Used to stale issues and pull requests label Mar 6, 2023
@kdinev
Copy link
Member

kdinev commented Mar 6, 2023

@ChronosSF Seems to me that an additional UI needs to be provided for this feature, because sorting direction by occurrence should also be modifiable (ascending, descending), while the regular sorting should also be controllable through the chip UI, as it currently is. @sdimchevski Could you take a look at this FR and we can discuss?

@Svetloslav15
Copy link
Contributor

Svetloslav15 commented Mar 8, 2023

@kdinev The PR above is creating custom sorting strategy for this scenario, and applying it in the groupBy sample. This can be achieved without breaking the current sorting behavior. First, when groupBy is applied rows are sorted in ASC order by fieldName, when the button for "Sort By Group Asc/Desc" is clicked, first time the groups will be sorted by number of values in each group DESC and if we click second time they will be sorted in ASC order.
grid-group-by
Would it be more beneficial to add this behavior internally to the grid component or to let users choose if they wants to implement it themselves?

@kdinev
Copy link
Member

kdinev commented Mar 8, 2023

@Svetloslav15 The newly exposed grouping strategy looks good to me.

@Svetloslav15 Svetloslav15 added ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged. and removed 🆕 status: new labels Mar 8, 2023
@hanastasov
Copy link
Contributor

The PR will not wait for design, we can verify the code and even merge it. However, @sdimchevski I think you can use thge dev demos and see how the feature works, if this would help with considering if any UI is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grid: groupby 🧰 feature-request ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants