# DkGridSorting

## Generics

<mark style="color:green;">`<T>`</mark> represents the object's shape coming from the data source.&#x20;

<mark style="color:green;">`<R>`</mark> represents the column data type: <mark style="color:green;">`string`</mark>, <mark style="color:green;">`number`</mark>, <mark style="color:green;">`Date`</mark>, or <mark style="color:green;">`boolean`</mark>.

## Methods

| Method                 | Description                                                                                                                                                                                                                                                                                    |                                                                                                          |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `sortBy()`             | <p>It sorts the DkGrid rows by the given column in the given direction.</p><p></p><p><strong>Params</strong>: </p><ol><li>column: <mark style="color:green;"><code>DkDataColumnDef\<T, R></code></mark>.</li><li>direction: <mark style="color:red;"><code>'asc'</code></mark>                 | <mark style="color:red;"><code>'desc'</code></mark></li></ol><p><strong>Return value</strong>: void.</p> |
| `isDkGridSortedBy()`   | <p>It evaluates if the DkGrid is sorted by the given column.</p><p></p><p><strong>Params</strong>: </p><ol><li>column: <mark style="color:green;"><code>DkDataColumnDef\<T, R></code></mark>.</li></ol><p><strong>Return</strong>: <mark style="color:green;"><code>boolean</code></mark>.</p> |                                                                                                          |
| `getCurrentSortable()` | <p>It returns the column and the direction of the sorting operation. Otherwise, it returns null.</p><p></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>DkColumnSorted\<T, R></code></mark>.</p>                                          |                                                                                                          |
| `clearSorting()`       | <p>It removes the current sorting operation.</p><p></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>void</code></mark>.</p>                                                                                                               |                                                                                                          |

## Events

| Event        | Description                                                                                                                                                                                                                                 |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sortChange` | <p>It emits the column and the direction of the current sorting operation.</p><p></p><p><strong>Params</strong>: None.</p><p><strong>Return</strong>: <mark style="color:green;"><code>Observable\<DkColumnSortEvent\<T></code></mark>.</p> |
