2016-11-18 53 views
1

是否有任何配置列以允许在模板列的帮助下进行排序?KendoUI Grid with Angular2:在列模板中配置排序

电网已经制定[sortable]="true"

能够直接配置在如下列:

<kendo-grid-column *ngFor="let col of columns;" field="{{col.Name}}" title="col.Name" [sortable]="col.CanSort">    
</kendo-grid-column> 

不能与下面的模板帮助配置:

<template *ngFor="let col of columns" let-column>     
    <kendo-grid-column field="{{col.Name}}" title="col.Name" [sortable]="false"> 
      <template kendoHeaderTemplate let-dataItem> 
       {{dataItem.field}}    
      </template> 
     </kendo-grid-column>     
</template> 

任何人有想法?

回答

1

最后我得到了一个答案:

我们必须在模板之前定义列标签。您还可以根据以下某些条件获取复选框列。

<kendo-grid-column *ngFor="let col of columns" field="{{col.Name}}" title="col.Name" [sortable]="col.CanSort" > 
     <template kendoCellTemplate let-dataItem *ngIf="col.DataType=='Boolean'"> 
       <input type="checkbox" [checked]="dataItem[col.Name]" disabled /> 
     </template>   
</kendo-grid-column>