2017-06-01 97 views
3

有誰知道如何在Kendo for Angular網格中設置默認排序字段?Kendo 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> 

回答

4

嘗試將gridState.sort屬性設置爲默認字段所需的值。

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

您可以設置您聲明它的屬性。

+0

完美。感謝您建立Kendo-Angular世界的知識庫J. – Zadok