Does anyone know how to set the default sort field in the Kendo for Angular grid?
<kendo-grid [data]="view | async"
          [pageSize]="gridState.take"
          [skip]="gridState.skip"
          [sort]="gridState.sort"
          [pageable]="{
            buttonCount: 3,
            info: true,
            type: 'numeric',
            pageSizes: true,
            previousNext: true
          }"
          [sortable]="true"
          (dataStateChange)="onStateChange($event)"
          (edit)="editHandler($event)" (cancel)="cancelHandler($event)"
          (save)="saveHandler($event)">
<kendo-grid-column field="Name" width="200" [editable]="false"></kendo-grid-column>
<kendo-grid-column field="Group" width="120" [editable]="false"></kendo-grid-column>
                Try setting the gridState.sort property to what you want for the default field.
gridState.sort = [{ 'field': 'createdDate', 'dir': 'desc' }];
You can set the property where you declare it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With