Get Free Trial
API reference
Table of contents

sortValues

sortValues(axisName: String, type: String, tuple: Array, measure: Object)

[starting from version: 1.4]

Sorts values in a specific row or column.

Parameters

  • axisName – String. The name of the axis to be sorted. It can be "rows" or "columns". To define the sorting for numbers in a specific row, set axisName to "rows". If the API call will define the sorting for a column, set axisName to "columns".
  • type – String. The sorting type: "asc", "desc", or "unsorted". The "unsorted" type allows clearing the sorting. See an example on JSFiddle.
  • tuple optional – Array of strings. The tuple identifying the column or the row in the table. It consists of the members’ unique names.
    The tuple property is required for "asc" and "desc" sorting types.
  • measure optional – Object. Identifies the measure on which the sorting will be applied. The measure property is required for "asc" and "desc" sorting types.
    The measure object has the following properties:
    • uniqueName – String. The measure’s unique name.
    • aggregation optional – String. The measure’s aggregation type.
      If the measure is calculated, skip the aggregation or set it to "none".

Examples

1) Sorting a certain column member in ascending order:

flexmonster.sortValues(
"columns",
"asc",
["category.[bikes]", "color.[red]"],
{"uniqueName": "Price"}
);

Check out on JSFiddle.

2) Clearing the sorting in columns:

flexmonster.sortValues("columns", "unsorted");

See the full code on JSFiddle.

See also

getSort
sortingMethod
setSort