Sort multiple columns on datagrid?

I have a problem that needs to be solved, please help me: Button Sort 1: Includes 2 options: 1 and 2Default: 1 Set = 1:The list of results below will be displayed in order: Sort 1: number (From small -> large) Sort 2: date (From old date -> new) Set = 2 (reverse above)
1 answers

Hi Nguyen,

Your question is a bit cryptic, so hopefully I understand your challenge.

Assumption 1: the filter by clicking a header in a datagrid is not sufficient, as it doesn't support a secondary sorting attribute when the value of that column is the same.

Assumption 2: there are 2 main sorting orders used: {number ASC, date ASC} and {number DESC, date DESC}

Check question: isn't number unique?


As datagrid doesn't allow to set multiple sorting columns out-of-the-box(except for default), you could develop a small work-around: put 2 datagrids on the page, one with default sort order 1 and one with default sort order 2. And show/hide using conditional visibility by toggling a boolean on a Non-persistent context entity.


Hopefully this makes sense. Good luck!