sorter-mixin
The sorter mixin is a post-processor mixin, compatible with list-mixin. It provides the ability to sort some resources, depending of the values of one of their properties.
Used by:
Attributes
order-asc
or order-desc
The name of the field you want to use to order the list.
To sort in ascending, use
order-asc
. To sort descending, useorder-desc
.In this example, the users list will be ordered alphabetically based on the username.
<solid-display data-src="http://server/users/" fields="username" order-asc="username" ></solid-display>
order-by-random
If the attribute is present, the list will be shuffled before being displayed
<solid-display data-src="http://server/users/" fields="username" order-by-random ></solid-display>
sorted-by
Available from version 0.16
Target a
<solid-form-search>
used to provide several options for the user to sort current list of resource.The
fields
attribute of<solid-form-search>
must at least containfield
.Field
attribute contains the fields of the resource to be offered to the user for sorting the data.
Order
attribute allows you to propose 2 sorting orders: ascending (asc
) and descending (desc
). By default, the order is ascending.The
<solid-display>
cannot combineorder-asc
ororder-desc
attribute ANDsorted-by
attribute.example:
<solid-form-search id="my-sorter" fields="field, order" enum-field="username, email" enum-order="ascending order = asc, descending order = desc" ></solid-form-search> <solid-display data-src="http://server/users" fields="username, last_name, email" sorted-by="my-sorter" ></solid-display>