Optional sorting when grouping

It would be awesome to be able to group by a field, but sort by another field. For example, group by name but sort by last modified date.

This is possible, you can sort your groups, but the sorting within the groups is still controlled by the collection sort/order settings

That’s the thing, I don’t want to sort my groups. I would like to sort by last modified but still group by a specific field. So the group field name wouldn’t be sorting

How would that work practically?
The order of the groups would depend on the value of the first item in the group?

2 practical ways of going about it for a line item and invoice example would be:

  1. allowing for other parent fields aside from the key to sort a grouping. for example a list of line items would be grouped by invoice (ex Invoice #223), but sorted by invoice modified date, so the most recently modified would always be at the top, regardless of the invoice key field.
  2. Allow for child fields to sort the group. using same example but sorting by the line item modified date. let’s say you edit the line item qty for 1 line item, then that parent invoice would be at the top of the list, and the line items would be sorted within the group by the modified date.