ascending( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Adds a sort to a query or sort, sorting by the specified fields in ascending order.

The ascending() method refines this query in ascending order of the specified fields. If you specify more than one field, ascending() sorts the results in ascending order by each field in the order they are listed.

You can sort the following types:

  • Number: Sorts numerically.
  • Date: Sorts by date and time.
  • String: Sorts lexicographically, so "abc" comes after "XYZ".
  • Reference: Compares by the ID of the referenced item as a String.

If a field contains a number as a String, that value is sorted alphabetically and not numerically. Items that do not have a value for the specified sort field are ranked lowest.

Note: Aggregations can only be used on collections you have created. They cannot be used on Wix app collections.

Method Declaration
Copy
Method Parameters
fieldsArray<string>Required

Fields used in the sort.

Returns
Return Type:WixDataAggregate
Did this help?