SpreadJS 14
Features / Pivot Table / Sort
In This Topic
    Sort
    In This Topic

    You can sort pivot table fields by using the sort method of the PivotTable class. The sorting order can be set to ascending or descending by using the SortType enumeration.

    The below gif demonstrates descending sorting order applied on the "City" field.

    The below example code shows how to set the sorting order to descending, in a pivot table.

    JavaScript
    Copy Code
    // add sort by descending on field "City"
    myPivotTable.sort("City", { sortType: GC.Pivot.SortType.desc });