如何在角度4的剑道网格中逐行添加动作按钮

时间:2018-02-21 12:46:51

标签: angular kendo-ui kendo-grid

我无法在angular4 Screenshot of grid中添加kendo-grid中的按钮 还有其他方法可以添加按钮吗?

<kendo-grid
    [data]="view | async"
    [pageSize]="state.take"
    [skip]="state.skip"
    [sort]="state.sort"
    [sortable]="true"
    [pageable]="true"
    [scrollable]="'none'"
    [filterable]="false"
    (dataStateChange)="dataStateChange($event)"
    > 
    <kendo-grid-column field="Discontinued" width="120">
         <button kendoButton >Default</button>
    </kendo-grid-column>               
    <kendo-grid-column field="name" title="NAME" width="200"></kendo-grid-column>
    <kendo-grid-column field="wef" title="WEF" width="200"></kendo-grid-column>

</kendo-grid>

1 个答案:

答案 0 :(得分:1)

要在单元格中显示按钮(或任何其他自定义内容),您需要将ng-templatekendoGridCellTemplate指令嵌套在kendo-grid-column中。 (Documentation

示例:Plunker

<kendo-grid
     ...
>
     <kendo-grid-column field="Discontinued" width="120">
         <ng-template kendoGridCellTemplate>
             <button kendoButton>Default</button>
         </ng-template>
     </kendo-grid-column> 

     ...
</kendo-grid>