Problem
When an editor opens the content list of a schema, the list always uses the built-in order: last modified first (ContentQueryParser adds lastModified desc when no sort is given). The only way to get a different initial order is a query in the URL.
For many schemas a different order is the natural one, for example:
- versioned documents (terms of service, policies) – newest version number first, not the last edited one,
- articles or events – by a date field (publication date, event start),
- dictionaries and menus – by an order field (
sortOrder), - banners or promotions – by priority / weight.
Today we create shared saved queries for this (“Shared queries” in the filter panel, also through the API: PUT /api/apps/{app}/ui/settings/schemas.{schema}.queries.{name}). Saved queries were also the suggested workaround in List page record sorting for entities. It works, but editors have to click the saved query every time they open the list from the menu. Without it, the first item is easily the wrong one, e.g. the last edited version of the terms instead of the newest version.
Proposal
A default query per schema, applied when the list is opened without a query in the URL:
- A new UI setting
schemas.{schema}.defaultQuery, stored next to the saved queries (schemas.{schema}.queries.*): app-shared, optionally overridden per user. Its value is a JSON query like the saved queries ({"sort":[{"path":"data.version.iv","order":"descending"}]}; a filter would work the same way). - The content list uses it in
loadContents()when the route has no query. A query in the URL still wins, so links and paging stay as they are. - In the saved queries menu: “Use as default for this schema” / “Remove default” (shared queries for users with permission to change shared UI settings, own queries for the user only).
Since it is a UI setting, it needs no schema or database change, and it can be set through the existing ui/settings endpoints, which is useful for teams that configure apps as code.
An alternative would be a “Default sort” option in the schema settings (UI tab next to “List fields”). That is more visible, but it needs a change in the schema model, so I think the UI setting is the smaller change.
Contribution
I would be happy to implement this and send a pull request, if you agree with the approach (or with a different one you prefer). Thanks!