close

Filter

loading table of contents...

Studio Developer Manual / Version 2107

Table Of Contents

7.12.6 Make Columns Sortable in Search and Repository View

Sorting can be enabled for custom columns by setting two mandatory attributes in the gridcolumn definition. The attribute sortable has to be set to true to enable sorting. The attribute sortField has to specify the Solr index column that should be used for sorting.

<GridColumn header="Creator"
            dataIndex="creator"
            sortable="true"
            u:sortField="creator"/>

Example 7.49. Two additional attributes for sorting.


The optional attribute sortDirection enables you to restrict the sort direction to only one direction. This is useful if sorting does only make sense in one direction. For example a user is usually not interested in the less relevant search result. So you want to disable sorting for relevance ascending. Possible attribute values are "asc" or "desc" where the value is the enabled sort direction.

<GridColumn header="Creator"
            dataIndex="creator"
            sortable="true"
            u:sortField="creator"
            u:sortDirection="desc"/>

Example 7.50. Optional sortDirection Attribute to enable only one sort direction.


You can make even hidden grid columns sortable. Hidden columns are not shown in the grid but users can select them from the sort drop down field. This is useful if columns do not have meaningful values (again relevance for example) or if you just do not want to blow up the grid too much. Hidden columns that do not have their hideable config option set to false can also be unhidden by the user using the grid header menu.

At last you can define one default sort column for each list in the collection view. The default sort column will be used when the user has not specified a sort criteria. To configure add the attribute defaultSortColumn with value true. For more fine grained configuration the attribute defaultSortDirection can be set to asc or desc to sort ascending or descending by default.

<GridColumn header="Creator"
            dataIndex="creator"
            sortable="true"
            u:sortField="creator"
            u:defaultSortColumn="true"
            u:defaultSortDirection="desc"/>

Example 7.51. defaultSortColumn Attribute to configure one column as the default for sorting.


Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.