# sortingEnable

## Description

Enables the ability to sort a datalist component.

## Input / Parameter

N/A

## Output

N/A

## Callback

N/A

## Video

Coming Soon.

## Example

In this example, we will first create a data list, which can then be made sortable with the `sortingEnable` function.

### Steps

1. First, add a "Enable Sorting" button and a datalsit component to the page.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-d44da90a35549c26dbce49b6fbec880e0fa208f7%2FsortingEnable-step-1.png?alt=media)
2. To load data into the datalist, we will need to create the following event flow.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-ba5295b3b8be3170c2eef2bf62b0613dafb9f367%2FsortingEnable-step-2.png?alt=media)

   a. For the `dataFromString` function

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-e849fead91b05a1b4d331ef23a870068c6c94889%2FsortingEnable-step-3.png?alt=media)

   | Field   | Value                                                                                                                                                                                                              |
   | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
   | dataset | l\_user                                                                                                                                                                                                            |
   | string  | ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-8d9e26a3370d8ef23dfe8ccd0fae2172334fe88e%2FsortingEnable-step-4.png?alt=media) |

   b. For the `loadData` function ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-49987def736b4bfae9c033cce8fc3b70de4a0701%2FsortingEnable-step-5.png?alt=media)
3. Finally, for our "Enable Sorting" button, we will add the `sortingEnable` function when the button is clicked.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-e3e53fbc8caa5127960fb2549b82e8939ab39ce5%2FsortingEnable-step-6.png?alt=media)

### Result

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-100a4c8be2c8282178260cafaa4b42701958f50b%2FsortingEnable-result-1.gif?alt=media)

## Links
