{/* Do not edit this file. It is automatically generated by API Documenter. */}


## SortingOptions

Setting model for data sorting

**Signature:**

```typescript
export interface SortingOptions
```

## Remarks

When [style](/refs/Interface/SortingOptions#style) is "exclusive", clicking the column header with the shift key operates as "inclusive".

When setting it as an option in [Grid](/refs/Class/GridBase), you only need to enter the necessary information.

## Example

```js
grid.setSortingOptions({enabled: false});
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [commitBeforeSorting](/refs/Interface/SortingOptions#commitbeforesorting) | boolean | Whether to commit before sorting |
| [enabled](/refs/Interface/SortingOptions#enabled) | boolean | Whether columns can be sorted by clicking on the column header |
| [handleVisibility](/refs/Interface/SortingOptions#handlevisibility) | [HandleVisibility](/refs/realgrid#handlevisibility) | How to display filter handles |
| [keepFocusedRow](/refs/Interface/SortingOptions#keepfocusedrow) | boolean | Whether to maintain the currently focused row when sorting |
| [nullsOrder](/refs/Interface/SortingOptions#nullsorder) | [NullsOrder](/refs/realgrid#nullsorder) | When sorting, place null, undefined, and `''`{/* */} first or last. |
| [outerSort](/refs/Interface/SortingOptions#outersort) | [OuterSortCallback](/refs/realgrid#outersortcallback) \| boolean | The grid behaves as if it is sorted without actually sorting it. |
| [pageSorting](/refs/Interface/SortingOptions#pagesorting) | boolean | Whether to sort by current page |
| [showSortOrder](/refs/Interface/SortingOptions#showsortorder) | boolean | Whether to display sort order when sorting multiple columns |
| [sortDataRow](/refs/Interface/SortingOptions#sortdatarow) | boolean | Whether to sort dataRows when the values ​​of the fields to be sorted are the same |
| [style](/refs/Interface/SortingOptions#style) | [SortStyle](/refs/realgrid#sortstyle) | How to specify sort status for multiple columns in a grid |
| [textCase](/refs/Interface/SortingOptions#textcase) | [SortCase](/refs/realgrid#sortcase) | Case sensitive |
| [toast](/refs/Interface/SortingOptions#toast) | [ToastOptions](/refs/Interface/ToastOptions) | Toast-related settings |

## Properties Desc

### commitBeforeSorting

Whether to commit before sorting

`Type` - boolean

<hr/>

### enabled

Whether columns can be sorted by clicking on the column header

`Type` - boolean

**Remarks:**

[orderBy()](/refs/Class/GridBase#orderby) is executed regardless of the value of this property.

<hr/>

### handleVisibility

How filter handles are displayed

`Type` - [HandleVisibility](/refs/realgrid#handlevisibility)

<hr/>

### keepFocusedRow

Whether to maintain the currently focused row when sorting

`Type` - boolean

<hr/>

### nullsOrder

When sorting, place null, undefined, and `''`{/* */} first or last.

`Type` - [NullsOrder](/refs/realgrid#nullsorder)

<hr/>

### outerSort

The grid behaves as if it is sorted without actually sorting it.

`Type` - [OuterSortCallback](/refs/realgrid#outersortcallback) \| boolean

**Remarks:**

It is used when reloading sorted data from the server rather than sorting using data in the DataProvider.

If set to `true`{/* */}, the user must specify the sorting state using grid.orderBy.

If you specify `function`{/* */}, the function will be called just before the onSortingChanged event.

**Example:**


```js
grid.sortingOptions.outerSort = true;
grid.onCellClicked = (grid, clickData) {
  // Example of sorting one field as the target
  if (clickData.cellType === "header") {
    const sortInfo = grid.getSortedFields();
    const fieldName = clickData.fieldName;
    const isSort = sortInfo && sortInfo.find(v => v.orgFieldName === fieldName);
    // let sortOrder = isSort ? (isSort.direction === 'ascending' ? 'descending' : null) : 'ascending';
    let sortOrder = (!isSort || isSort.direction === 'descending') ? 'ascending' : 'descending';

    if (sortOrder) {
      grid.orderBy([fieldName], [sortOrder]) // Grid only displays sort order in the header.
    } else {
      grid.orderBy([]);
    }
    getData(fieldName, sortOrder) // Perform dataProvider.setRows within getData.
  }
}
```

<hr/>

### pageSorting

Whether to sort based on the current page

`Type` - boolean

<hr/>

### showSortOrder

Whether to display sort order when sorting multiple columns

`Type` - boolean

<hr/>

### sortDataRow

Whether to sort dataRows when the values ​​of the fields to be sorted are the same

`Type` - boolean

<hr/>

### style

How to specify sort status for multiple columns in a grid

`Type` - [SortStyle](/refs/realgrid#sortstyle)

<hr/>

### textCase

Case sensitive

`Type` - [SortCase](/refs/realgrid#sortcase)

<hr/>

### toast

Toast-related settings

`Type` - [ToastOptions](/refs/Interface/ToastOptions)

**Remarks:**

It follows the [ToastOptions](/refs/Interface/ToastOptions) model.

<hr/>