Best approach for multi-column (cumulative) sorting in Data Grid 2 — reusable across entities?

0
I'm looking for the recommended way to implement multi-column sorting in Data Grid 2, and I'd appreciate feedback on my planned approach.Users need to sort a grid by more than one column at the same time. For example: sort by Product Name ascending, then by Size, then by Quantity — and all three sort levels should stay active together. Right now, sorting by a second column clears the sort on the first one (only a single sort criterion is kept at a time). The customer also requires that on a grid with, say, 20 columns, every column must be sortable.1.Cumulative multi-column sorting (primary / secondary / tertiary … in a user-defined order).2.A generic, reusable solution that works across multiple grids, each backed by a different entity / data source, without rebuilding the logic for every grid.
asked
1 answers
1

Hi Bosung Kim,


If the requirement is that users can build a cumulative sort order (e.g. Product Name → Size → Quantity), I don't believe Data Grid 2 currently supports Excel-style multi-column sorting through repeated header clicks out of the box. There is an Idea request asking for this capability.


If a default multi-column sort is sufficient, you can configure multiple sort attributes directly in the Data Grid 2 datasource settings, for example:

ProductName ASC
Size ASC
Quantity DESC

This works for database and XPath data sources.


For a reusable solution across different entities, I would store the user's sort preferences in a generic entity (Attribute, Direction, Sequence) and retrieve the data through a datasource microflow. This avoids creating custom logic for every grid and gives you flexibility to persist user preferences.


Store the user's selected sort criteria and drive the grid from a datasource microflow (or query layer). This keeps the implementation generic and avoids entity-specific sorting logic.


One additional consideration is user experience. If multiple sort levels are active, users should be able to see the order (for example: Product ↑ (1), Size ↑ (2), Quantity ↓ (3)) so the resulting sort remains understandable.


I hope this helps answer your question. If you need any additional details, feel free to reply below.


Best regards,

Oswaldo Valles

answered