简体   繁体   English

angular2 kendo -grid列定义

[英]angular2 kendo -grid column definition

I want to create a column dictionary, but haven't found a way to create column definitions programmatically. 我想创建一个列字典,但是还没有找到一种以编程方式创建列定义的方法。 Answers that I have found doesn't allow reuse of the template that is inside the column definition and they are different. 我发现的答案不允许重复使用列定义中的模板,并且它们是不同的。

For example look at these two possible column definitions 例如,看一下这两个可能的列定义

<kendo-grid-column>
    <ng-template kendoGridCellTemplate let-dataItem>
        <div class="k-button" (click)="edit(dataItem)">
            <span class="k-icon k-i-pencil"></span>
        </div>
    </ng-template>
</kendo-grid-column>


<kendo-grid-column field="anyField" >
    <ng-template kendoGridCellTemplate let-dataItem>
        <div>
             {{dataItem.anyField}}
        </div>
    </ng-template>
</kendo-grid-column>

使用* ngFor将列定义转换为kendo网格的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM