# Angular Grid Sorting Basics

The sorting functionality enables you to arrange the data by single or multiple fields in ascending or descending order.

Enable the sorting feature by using two methods:

* [Automatic Data Processing](https://www.telerik.com/kendo-angular-ui/components/grid/sorting/basics#automatic-data-processing)—Implement sorting (or other [data operations](https://www.telerik.com/kendo-angular-ui/components/grid/data-operations)) with less code.
* [Manual Sorting](https://www.telerik.com/kendo-angular-ui/components/grid/sorting/manual-sorting)—Provides more control when you implement the sorting feature.

For custom sorting logic, such as sorting string numbers numerically, refer to the [Custom Sorting](https://www.telerik.com/kendo-angular-ui/components/grid/sorting/manual-sorting#custom-sorting) section.

## Automatic Data Processing

When you use the built-in [`DataBindingDirective`](https://www.telerik.com/kendo-angular-ui/components/grid/api/databindingdirective), the [Angular Grid](https://www.telerik.com/kendo-angular-ui/components/grid) performs the sorting automatically. To enable the sorting when the `kendoGridBinding` directive is applied:

1. Set the [`sortable`](https://www.telerik.com/kendo-angular-ui/components/grid/api/gridcomponent#sortable) option of the Grid.
2. (Optional) Set the [`sort`](https://www.telerik.com/kendo-angular-ui/components/grid/api/gridcomponent#sort) property to a collection of [`SortDescriptor`](https://www.telerik.com/kendo-angular-ui/components/data-query/api/sortdescriptor) objects to sort the data by specific criteria during the initialization of the Grid.

```html
<kendo-grid
    [kendoGridBinding]="gridData"
    [sortable]="true">
    <kendo-grid-column field="ProductID"></kendo-grid-column>
</kendo-grid>
```

> Further details on how the data binding directive works under the hood are available in the [data operations with the built-in directive](https://www.telerik.com/kendo-angular-ui/components/grid/data-operations#automatic-data-processing) documentation section.

The following example demonstrates the Grid sorting functionality when the `kendoGridBinding` directive is applied.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/sorting/source.txt)

## Suggested Links

* [AI-Powered Sorting](https://www.telerik.com/kendo-angular-ui/components/grid/smart-grid/ai-toolbar-assistant)
* [Manual Sorting](https://www.telerik.com/kendo-angular-ui/components/grid/sorting/manual-sorting)
* [Multi-column Sorting](https://www.telerik.com/kendo-angular-ui/components/grid/sorting/multi-sort)
* [Sorting Groups with Compare Callback](https://www.telerik.com/kendo-angular-ui/components/grid/grouping/group-sorting#custom-group-sorting)
* [API Reference of the GridComponent](https://www.telerik.com/kendo-angular-ui/components/grid/api/gridcomponent)
* [API Index of the Grid](https://www.telerik.com/kendo-angular-ui/components/grid/api)
