# Sorting

Canonical page: https://www.adaptabletools.com/docs/handbook-sorting

- AdapTable provides many different ways to sort AG Grid according to your precise requirements:
    - **Column Sorting** is part of each Layout: `ColumnSorts` stores which columns are sorted and in which order
    - **Custom Sorts** will sort a column using a bespoke order — a hard-coded  list of values or a comparer function
    - **Pivot**, **Row Groups**, and **Server Side Row Model** have their own sorting behaviours

AdapTable sorts AG Grid for you when required:

- Layout State holds the **column sort model**
- Custom Sort module adds **non-default ordering** per column when needed

## Sorting Topics

Sorting is documented in several places, depending on use case:

| Topic                                                                                        | Summary                                                                                                                                   |
| -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| [Table Layouts — column sorting](https://www.adaptabletools.com/docs/handbook-layouts-table-sorting/index.md)  | `ColumnSorts` in table Layouts, applying sorts at run time, invisible columns, autogenerated columns                                      |
| [Sorting Pivot Layouts](https://www.adaptabletools.com/docs/handbook-layouts-pivot-sorting/index.md)           | Sorting in pivot views                                                                                                                    |
| [Sorting Row Groups](https://www.adaptabletools.com/docs/handbook-grouping-rows-sorting/index.md)              | Priority: custom sort, ColDef comparator, Layout `ColumnSorts`, default AG Grid order                                                     |
| [Server-side Sorting](https://www.adaptabletools.com/docs/dev-guide-row-models-server-sorting/index.md)        | `sortModel` on `getRows` requests; supplement on the server when using [custom sorts](https://www.adaptabletools.com/docs/handbook-custom-sorting/index.md) |
| [Custom Sorting](https://www.adaptabletools.com/docs/handbook-custom-sorting/index.md)                         | Lists and comparers (`customSortComparers`), Settings Panel wizard for list-based sorts                                                   |
| [Tree Grid Sorting](https://www.adaptabletools.com/docs/handbook-tree-data-grid/index.md#sorting)              | Sorting when using Tree Grid                                                                                                              |
| [Sorting Technical Reference](https://www.adaptabletools.com/docs/technical-reference-custom-sorting/index.md) | Custom Sort State and Options, Custom Sort API, `GridSorted` event                                                                        |
