ascending( )


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

The ascending() function refines a WixSearchBuilder to sort 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".
  • Boolean: false comes after true.

If a property contains a number as a string, that value will be sorted alphabetically and not numerically. Documents that do not have a value for the specified sort property are ranked lowest.

Method Declaration
Copy
Method Parameters
fieldArray<string>Required

The fields used in the sort.

Returns
Return Type:WixSearchBuilder
Was this helpful?
Yes
No