Reputation: 14669
Is there any to configure column to allow sort or not with help of template column.
Grid has already set [sortable]="true"
I am able to configure in direct on column as below:
<kendo-grid-column *ngFor="let col of columns;" field="{{col.Name}}" title="col.Name" [sortable]="col.CanSort">
</kendo-grid-column>
But not able to configure with help of template as below:
<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>
Any one has idea?
Upvotes: 1
Views: 996
Reputation: 14669
Finally I got an answer:
we have to define column tag prior to the template one. You can also get checkbox column based on some condion as below.
<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>
Upvotes: 1