# Sorting Fields in PivotEngine

Learn how to sort fields in Wijmo's OLAP components in this documentation topic

## Content


Sorting is controlled by the __PivotEngine__, but it can be done through the __PivotGrid__ also. You can sort a field by clicking on the PivotGrid's column headers.

The __PivotEngine__ automatically sorts dimension (row and column) fields when it generates data summaries, but it does not sort measure (value) fields by default.

## Sorting Dimension (Row/Column) Fields
You can change the sort direction on dimension fields by setting the field's __sort__ property in code.

Users may switch the sort direction by clicking the headers on any __PivotGrid__ control attached to the engine (as long as the grid's __allowSorting__ property is set to true).

The __PivotGrid__ control does not show dimension field sort setting by default, but you can set the __showRowFieldSort__ property to true if you want that feature.

## Sorting Measure (Value) Fields
Measure fields are not sorted by default. You can set their sort direction by changing the __sortDescriptions__ property of the engine's __pivotView__ collection (which contains the summary generated by the engine).

For implementation, refer to the [PivotEngine Sort](/wijmo/demos/OLAP/PivotPanel/Fields/Customize/FieldSettingsDialog/Sort/purejs) demo.

