[FEATURE] Adds sorting for grouping

Resolves: #60384

Change-Id: I3edfb6f24ba1b9336ac57642f0cf7ac2da0addf5
Reviewed-on: https://review.typo3.org/31668
Reviewed-by: Sascha Egerer <sascha@sascha-egerer.de>
Tested-by: Sascha Egerer <sascha@sascha-egerer.de>
Reviewed-by: Phuong Doan <phuong.doan@dkd.de>
Tested-by: Phuong Doan <phuong.doan@dkd.de>