# Sorting

The KendoReact PivotGrid component supports sorting through the [`usePivotOLAPService`](https://www.telerik.com/kendo-react-ui/components/pivotgrid/api/usepivotolapservice) hook or the [`PivotOLAPService`](https://www.telerik.com/kendo-react-ui/components/pivotgrid/api/pivotolapservice) higher-order component.

The `sort` property is a JavaScript array of [SortDescriptor](https://www.telerik.com/kendo-react-ui/components/dataquery/api/sortdescriptor) objects containing the following keys:

* field—The name of the dimension, for example, `[Date].[Calendar]`.
* dir—The direction of the sorting.

> All inner members of the selected dimension will also be sorted.

## Configuration

To set an initial `sort`, pass the [`defaultSort`](https://www.telerik.com/kendo-react-ui/components/pivotgrid/api/pivotolapserviceargs) property to the [`usePivotOLAPService`](https://www.telerik.com/kendo-react-ui/components/pivotgrid/api/usepivotolapservice) hook or the [`PivotOLAPService`](https://www.telerik.com/kendo-react-ui/components/pivotgrid/api/pivotolapservice) higher-order component.

The following example demonstrates the basic configuration of the default sorting.

[Demo Source](https://demos.telerik.com/kendo-react-ui/pivotgrid/sort/configuration/func/source.txt)

## Suggested Links

* [PivotGrid Filtering](https://www.telerik.com/kendo-react-ui/components/pivotgrid/filtering)
* [API Reference of the KendoReact usePivotOLAPService hook](https://www.telerik.com/kendo-react-ui/components/pivotgrid/api/usepivotolapservice)
* [API Reference of the KendoReact PivotOLAPService HOC](https://www.telerik.com/kendo-react-ui/components/pivotgrid/api/pivotolapservice)
