我有一个Kendo网格,根据数据,我需要在一列中使用不同的输入控件 . 我有三种情况:
如果值为 true ,则复选框应出现在编辑状态 .
true
如果值为 string 或 number ,则应编辑文本框
string
number
如果值为“更多”,则应编辑超链接 .
请参阅上面的截图 .
在模板中,您可以在其中定义列,您可以为单元格使用自定义模板 . 在这里你可以写一些条件来决定渲染什么:
<kendo-grid-column field="example" title="Example" width="100"> <ng-template kendoGridCellTemplate let-dataItem> <!-- You can use ngIf and/or ngSwitch here. --> </ng-template> </kendo-grid-column>
API:https://www.telerik.com/kendo-angular-ui/components/grid/api/CellTemplateDirective/
1 回答
在模板中,您可以在其中定义列,您可以为单元格使用自定义模板 . 在这里你可以写一些条件来决定渲染什么:
API:https://www.telerik.com/kendo-angular-ui/components/grid/api/CellTemplateDirective/