Need a special offer?Find out if your project fits.
+
All documentation
API reference
  • API Reference for older versions
  • setFlatSort

    setFlatSort(flatSort: FlatSortObject[])

    [starting from version: 2.8.2]

    Sorts columns in the flat form.

    Use the sortValues method for sorting in the compact form, the classic form, and the chart view.

    Note that the setFlatSort method is available only for reports based on "csv", "json", and "api" data source types.

    Parameters

    Parameter/Type Description
    columns
    FlatSortObject[]
    Defines sorting in the flat form.

    Note Columns are sorted in the order they were specified (i.e., the first column is sorted first, and so on). Therefore, take the columns’ order into account when sorting multiple columns. See an example on JSFiddle.

    Example

    let sort = [ 
      {
        uniqueName: "Category",
        sort: "desc"
      },
      {
        uniqueName: "Price",
        sort: "asc"
      }
    ];
    flexmonster.setFlatSort(sort); 

    Try the example on JSFiddle.

    See also

    getFlatSort
    getSort
    setSort
    sortingMethod