Overview
The Sorting component is used to select the logic for ordering search results.
Selector
The selector for this component is <hawksearch-sorting>
.
Data Model
The Sorting data model is exposed to the Handlebars template. For more information, see Search Models.
interface SortingOption {
title: string;
value: string;
default: boolean;
selected: boolean;
}
interface Sorting {
value?: string;
options: Array<SortingOption>;
}
Event Binding Attributes
Attribute Name | Attribute Value |
---|---|
hawksearch-sort |
When a select
element with this attribute changes in value, the search will be updated to use that value as the new sort order.
Default Template
<div class='sorting'> <select hawksearch-sort> {{#each options}} <option value='{{value}}' {{attribute 'selected' selected}}>{{title}}</option> {{/each}} </select> </div>