Sorting

The TreeGrid control for JavaScript has built-in support for Sorting one or more columns.

Sorting columns

TreeGrid allows the items to be sorted in ascending or descending order based on the selected column by enabling the allowSorting property in TreeGrid control. The following code example shows you how to enable Sorting in TreeGrid control.

  • javascript
  • <ej-treegrid id="TreeGridControl" [allowSorting]="true"
        //...>
    </ej-treegrid>

    Multicolumn sorting

    TreeGrid allows you to sort multiple columns by clicking the desired column headers while holding the Ctrl key. The following code example shows you how to enable Multicolumn sorting in TreeGrid control.

  • javascript
  • <ej-treegrid id="TreeGridControl" [allowSorting]="true" [allowMultiSorting]="true"
        //...>
    </ej-treegrid>

    The following screenshot shows the output of multicolumn sorting in TreeGrid control.