You can sort pivot table fields by using the PivotTable.sort class method. 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 }); |