Sorting Lists
Sort Attributes
List Attributes
A list is defined via a <form-property> element of type DirectoryEntryBean[].The list supports two attributes related to sorting.
-
sortable – A Boolean flag.If set to “false”, the flag disables sorting for all columns in the list.This is used for example for the list of outstanding resource orders on overview pages since sorting would blend rows belonging to different orders.
-
secondarySortColumns – A comma-separated list of the names or indexes of the columns that serve as secondary sort criteria, for example “0,1” for the first and second column, or “sn,gn” for the columns with name “sn” and “gn”.The default secondary sort criterion is the first column “0”.
Column Attributes
A column is defined via a <data-property> child element of a list.The column supports two attributes related to sorting.
-
sortable – A Boolean flag.If set to “false”, the flag disables sorting for the column.Note that Web Center doesn’t support sorting for some types of columns.
-
sortIndexes – A comma-separated list of the indexes of the columns that serve as sort criteria, for example “2,0,1” for the third, first and second column.
Sort Attribute Evaluation
If a user clicks on the header cell of a table column, the list is sorted according to the following rules (in descending precedence):
-
If list attribute “sortable” is set to false, sorting is disabled for each column in the list.
-
If column attribute “sortable” is set to false, sorting is disabled for the column.
-
If column attribute “sortIndexes” is set, then the list is sorted as specified in the attribute value.Attribute “secondarySortColumns” is ignored.
-
The list is sorted by the values in the column.Attribute “secondarySortColumns” is evaluated for secondary sort columns.If left unspecified, the first column serves as secondary sort criterion.
Samples
Sample 1
The first example doesn’t specify any sort attribute at all.The first columns serves as secondary sort criterion.This will suit most lists.
<form-property name="users">
<data-property name="sn"/>
<data-property name="ou"/>
<data-property name="tn"/>
</form-property>
Click on header of column "sn": sort by "sn".
Click on header of column "ou": sort by "ou" first, "sn" second.
Click on header of column "tn": sort by "tn" first, "sn" second.
Sample 2
The next example defines two secondary sort columns. This will suit almost all other lists.
<form-property name="users" secondarySortColumns="sn,ou">
<data-property name="sn"/>
<data-property name="ou"/>
<data-property name="tn"/>
<data-property name="fax"/>
</form-property>
Click on header of column "sn": sort by "sn" first, "ou" second.
Click on header of column "ou": sort by "ou" first, "sn" second.
Click on header of column "tn": sort by "tn" first, "sn" second, "ou" last.
Click on header of column "fax": sort by "fax" first, "sn" second, "ou" last.
Sample 3
The next sample defines individual sort orders for the first three columns. The default sort order applies to the 4th column, with the first column as default secondary sort criterion. Sorting is disabled for the last column.
<form-property name="users">
<data-property name="sn" sortIndexes="0,1,2"/>
<data-property name="ou" sortIndexes="1,2"/>
<data-property name="tn" sortIndexes="2"/>
<data-property name="fax"/>
<data-property name="gn" sortable="false"/>
</form-property>
Click on header of column "sn": sort by "sn" first, "ou" second, "tn" last.
Click on header of column "ou": sort by "ou" first, "tn" second.
Click on header of column "tn": sort by "tn".
Click on header of column "fax": sort by "fax" first, "sn" second.
Click on header of column "gn": is ignored.
Sample 4
The next sample defines individual sort orders for the first two columns. Sorting is disabled for the 3rd and the last column. The default sort order applies to the 4th column, with the second column as secondary sort criterion.
<form-property name="users" secondarySortColumns="1">
<data-property name="sn" sortIndexes="0,1,2"/>
<data-property name="ou" sortIndexes="1,2"/>
<data-property name="tn" sortIndexes="2" sortable="false"/>
<data-property name="fax"/>
<data-property name="gn" sortable="false"/>
</form-property>
Click on header of column "sn": sort by "sn" first, "ou" second, "tn" last.
Click on header of column "ou": sort by "ou" first, "tn" second.
Click on header of column "tn": is ignored.
Click on header of column "fax": sort by "fax" first, "ou" second.
Click on header of column "gn": is ignored.
Sample 5
The last list is not sorted at all.
<form-property name="users" sortable="false">
…
</form-property>