igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

Order by count in igx-grid group by

Open Eralmidia opened this issue 2 years ago • 4 comments

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

Eralmidia avatar May 31 '22 08:05 Eralmidia

@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?

ChronosSF avatar Jun 01 '22 11:06 ChronosSF

@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?

kdinev avatar Jun 02 '22 06:06 kdinev

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.

ChronosSF avatar Jun 02 '22 07:06 ChronosSF

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

github-actions[bot] avatar Aug 29 '22 00:08 github-actions[bot]

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

github-actions[bot] avatar Oct 29 '22 00:10 github-actions[bot]

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

github-actions[bot] avatar Dec 31 '22 00:12 github-actions[bot]

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

github-actions[bot] avatar Mar 05 '23 00:03 github-actions[bot]

@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?

kdinev avatar Mar 06 '23 08:03 kdinev

@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?

Svetloslav15 avatar Mar 08 '23 13:03 Svetloslav15

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

kdinev avatar Mar 08 '23 13:03 kdinev

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.

hanastasov avatar Mar 08 '23 14:03 hanastasov