{{ html.orderby }} – Order By (Sort By) Dropdown

This tag generates an HTML dropdown that allows visitors to sort the table by selected fields. If no fields are specified, all available fields will be included.

Basic usage

{{ html.orderby }}

This renders a dropdown with all available fields for sorting.

Selecting Specific Fields

You can specify a comma-separated list of fields that users can choose from to sort the table in the front-end. If left empty, all available fields will be included.

{{ html.orderby(Field List,Show Label,CSS Class) }}
  • Field List – Comma-separated list of fields
  • Show Label – [true/false] Display a text label before the dropdown menu. False is default.
  • CSS Class – Name or names of CSS class(s). “form-select” for Joomla 4,5 and “inputbox” for Joomla4

Example:

{{ html.orderby("name,price",true,"form-select") }}

Generated HTML Example

The dropdown will include both ascending and descending sorting options:

<select name="esordering" id="esordering" onchange="ctOrderChanged(this.value, null);" class="form-control">
<option value=""> - Order by</option>
<option value="name">Name A-Z</option>
<option value="name desc" selected="">Name Z-A</option>
<option value="price">Price A-Z</option>
<option value="price desc">Price Z-A</option>
</select>


What are your feelings

Leave a Reply

Updated on February 14, 2025