On Grid with grouping feature, change the sorting order in the grouped column

StackOverflow https://stackoverflow.com/questions/22504320

  •  17-06-2023
  •  | 
  •  

Pregunta

As an example, suppose that a grid exists with the following columns: Name, Age, Pet.

Also suppose the only possible pets are from the set (Dog, Cat, Fish).

I have applied the grouping feature with groupField: 'Pet'. By default, the grid is rendered with the rows grouped by pets in the ascending order of possible pets.

Something like:

Pet: Cat (30)
----------------
[30 Cat Rows]

Pet: Dog (10)
----------------
[10 Cat Rows]

Pet: Fish (10)
----------------
[10 Cat Rows]

I want to control the sorting order of the grouped column too, so the order of the groups can be descending too:

Pet: Fish (10)
----------------
[10 Cat Rows]

Pet: Dog (10)
----------------
[10 Cat Rows]

Pet: Cat (30)
----------------
[30 Cat Rows]

The above should be supported for any column (on which grouping is possible) in the grid.

Is there a way to achieve this?

¿Fue útil?

Solución

Check groupDir, setting groupDir: 'DESC' should work..

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top