Kendo for Angular default sorting

Does anyone know how to set the default sort field in Kendo grid for Angular?

<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>

      

+3


source to share


1 answer


Try setting the gridState.sort property to what you want the default field to do.

gridState.sort = [{ 'field': 'createdDate', 'dir': 'desc' }];

      



You can set the property where you declare it.

+5


source







All Articles