Table of contents

sortingMethod

sortingMethod(hierarchyName:String, compareFunction:Function)

[starting from version: 2.6]

Sets custom sorting for hierarchy members. For more details about defining custom sort please refer to Custom sorting tutorial.

Parameters

  • hierarchyName – String. The unique name of the hierarchy to which the sorting is applied.
  • compareFunction – Function. Defines the sort order. The input parameters are the same as for compareFunction of Array.sort() method.

Example

The following example shows sorting with really simple compareFunction which sorts elements in reverse alphabetical order:

flexmonster.sortingMethod("Category", function (a, b) {
    return a < b ? 1 : -1;
});

Try the example on JSFiddle.

See also

Custom sorting
setSort
getSort
sortValues