Related to: https://www.cuba-platform.com/discuss/t/cannot-get-the-current-sorting-applied-to-a-table-component
Even if the above issue has been solved, I cannot find a way to declare the initial sorting of the table, if my collectionDatasource is initially ordered.
EDIT: This problem becomes more severe when applied to nested datasources… In that case it is impossible to define the initial sorting declaratively in XML (you need to apply the sort by writing code in the controller, but for this simple need should be avoided).
declare a collectionDatasource like
select s from webschool$Section s order by s.label
then declare a table
<column id="label" <i>[[ HERE I'd like an attribute such as initialSortPriority="0" that tells this field should be ordered by default on first opening AND it is the first one of many ]]</i>/>
in this case there is no visual clue for the user that the table is indeed ordered by label…
IMHO it is best to avoid the order by clause altogether, and instead add an attribute to the column that triggers the orderby on initial screen opening.
When the user overrides the default ordering, that attribute would be ignored.
Actually, to specify multiple columns, the attribute could be an integer one, that indicates the sort priority, and there should be another attribute for the order (ASC or DESC).
So for example:
<column id="label" initialSortPriority="0" initialSortOrder="desc"/>