---
title: DataTableSorting
framework: applenewsformat
role: symbol
role_heading: Object
path: applenewsformat/datatablesorting
---

# DataTableSorting

A data category by which to sort the table in descending or ascending order.

## Declaration

```data
object DataTableSorting
```

## Properties

descriptor: The identifier property of one of the table’s data descriptors. See DataDescriptor. direction: The data sorting direction.

## Discussion

Discussion In a DataTable object, use the sortBy property to sort data already in a table. You can specify which data is to be sorted and the order (ascending or descending). If this property is not defined, data is displayed in the order it is provided in the RecordStore. This object can be used in DataTable. Example {   "components": [     {       "role": "datatable",       "showDescriptorLabels": true,       "sortBy": [         {           "descriptor": "id-name",           "direction": "descending"         }       ],       "data": {         "descriptors": [           {             "identifier": "id-name",             "key": "name",             "label": {               "type": "formatted_text",               "text": "Name",               "textStyle": {                 "textColor": "black"               }             },             "dataType": "string"           },           {             "identifier": "id-occupation",             "key": "occupation",             "label": "Occupation",             "dataType": "string"           }         ],         "records": [           {             "name": "Amelia Earhart",             "occupation": "Pilot"           },           {             "name": "Grace Hopper",             "occupation": "Computer Scientist"           }         ]       }     }   ] }

## See Also

### Tables with JSON Data

- [Adding a JSON Table](applenews/adding-a-json-table.md)
- [DataTable](applenewsformat/datatable.md)
- [RecordStore](applenewsformat/recordstore.md)
- [DataDescriptor](applenewsformat/datadescriptor.md)
- [DataFormat](applenewsformat/dataformat.md)
- [FloatDataFormat](applenewsformat/floatdataformat.md)
- [ImageDataFormat](applenewsformat/imagedataformat.md)
