单击Angular 2 kendo网格排序

时间:2017-10-01 03:42:00

标签: angular kendo-ui-angular2

我想在包含其列的下拉列表更改事件中对kendo网格进行排序。 我可以在下拉更改时应用排序功能吗?

1 个答案:

答案 0 :(得分:0)

Grid状态(skip,take,sort,filter ...)配置可以绑定到State object,而DropDownList valueChange event又可以在EXAMPLE处理程序中修改,例如:

<kendo-grid
    [data]="gridData"
    [pageSize]="state.take"
    [skip]="state.skip"
    [sort]="state.sort"
    [filter]="state.filter"
    [sortable]="true"
    [pageable]="true"
    [filterable]="true"
    (dataStateChange)="dataStateChange($event)"
>
...
<kendo-dropdownlist 
  [data]="dropDownData"
  (valueChange)="onDropDownChange($event)"></kendo-dropdownlist>
...
public onDropDownChange(e){
  this.state.sort = [{
    field: e,
    dir: 'asc'
  }];

  this.gridData = process(sampleProducts, this.state);
}

Demo