sort(collection, propertyKey[, sortDescending = false])

Sorts the given collection according to the given property key and returns the result in a new collection. The optional parameter sortDescending is a boolean flag that indicates whether the sort order is ascending (default) or descending. This method is often used in conjunction with find().

The sort() and find() functions are often used in repeater elements in a function query, see Repeater Elements.


Name Type Description
collection Collection The collection to be sorted
propertyKey String The name of the property
sortDescending Boolean Sort descending, if true. (optional) (default: false)



results in

[f1296679173b49f894f125056aecf4b5, 1224b74c018e4adf9cd6f5c07393f369, c3fe6646c03e4f62a8f31177fa979fd6]
About this article
Last change 2019-06-11
Topics FrontendFunctionsStructr 2.0