Skip to content

@DefaultTableSortingExpression

The @DefaultTableSortingExpression annotation overrides the default sorting order specifically for the entity's table view. It uses the same ${fieldName} placeholder syntax as @DisplayFormat and @SortingExpression.

When not set, the table view falls back to the entity's sortingExpression.

Usage

java
@DefaultTableSortingExpression(value = "${createdDate}", descending = true)
@SquizyEntity(sortingExpression = "${name}")
@Entity
public class Order { /* ... */ }

In this example, orders are sorted by name in dropdowns and relationship lists, but by createdDate (most recent first) in the table view.

This is equivalent to using the defaultTableSortingExpression attribute on @SquizyEntity:

java
@SquizyEntity(
    sortingExpression = "${name}",
    defaultTableSortingExpression = "${createdDate}"
)
@Entity
public class Order { /* ... */ }

Attributes

value

The sorting expression using ${fieldName} placeholders:

java
@DefaultTableSortingExpression("${lastName} ${firstName}")

descending

When true, the default table sort order is descending:

java
@DefaultTableSortingExpression(value = "${createdDate}", descending = true)