2016-11-18 2 views
1

템플릿 열의 도움으로 정렬을 허용하거나 허용하지 않도록 열을 구성 할 수 있습니까?KendoUI Grid Angular2 : 열 템플릿에서 정렬 구성

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

그러나 수없는 아래와 같은 템플릿의 도움으로 구성 :

그리드는 이미 [sortable]="true"

내가 다음과 같이 열을 직접적으로 구성 오전 설정 한

<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

마지막으로 대답을 얻었습니다.

템플릿 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>