Skip to main content

sortNumber

sortNumber

Sorts a DataSet list field numerically.

Parameters

  • dmName (String): The DataSet name (DM name)
  • responseKey (String): The field path within the list to sort by (e.g. "list.price")
  • asc (String): The sort direction
    • "ascending" — ascending order
    • "descending" — descending order
    • "origin" — restore the original order
  • attrPath (String or null): An alternate attribute path to sort by instead of the field value. Pass null if not needed

Returns: None (void)

Description

Sorts the DataSet's list using numeric comparison. Sorting a string field with this method parses the values as numbers before comparing them — use sortString for string fields.

Example

$vm.sortNumber("stock", "list.price", "descending", null);

Related

  • $vm.sortString(dmName, responseKey, asc) — sort as strings
  • $vm.sortBy(dmName, jsonData) — sort by multiple conditions