Kendo ui 如何在网格中为angular的kendoUI实现下拉列表。Can';我找不到任何文件
差不多。但是这个例子是针对jquery的kendoUI的。我需要angular的kendoUI文档。我在我的应用程序中这样做。以下是它的一个简单版本: HTML模板Kendo ui 如何在网格中为angular的kendoUI实现下拉列表。Can';我找不到任何文件,kendo-ui,kendo-grid,kendo-ui-angular2,Kendo Ui,Kendo Grid,Kendo Ui Angular2,差不多。但是这个例子是针对jquery的kendoUI的。我需要angular的kendoUI文档。我在我的应用程序中这样做。以下是它的一个简单版本: HTML模板 <kendo-grid [data]="someData" [height]="750"> <kendo-grid-column field="LaborType" title="Task" width="120"
<kendo-grid [data]="someData" [height]="750">
<kendo-grid-column field="LaborType" title="Task" width="120">
<ng-template kendoGridCellTemplate let-dataItem>
{{ GetLaborTypeDesc(dataItem.LaborType)?.LaborTypeDesc }}
</ng-template>
<ng-template kendoGridEditTemplate>
<kendo-dropdownlist [defaultItem]="{LaborTypeID: null, LaborTypeDesc: 'Select a task...'}" [data]="LaborTypes"
textField="LaborTypeDesc" valueField="LaborTypeID" [valuePrimitive]="true">
</kendo-dropdownlist>
</ng-template>
</kendo-grid-column>
</kendo-grid>
{{GetLaborTypeDesc(dataItem.LaborType)?.LaborTypeDesc}
Typescript
LaborTypes: Array<{ LaborTypeDesc: string, LaborTypeID: number }> = [];
public GetLaborTypeDesc(id: number): any {
return this.LaborTypes.find(x => x.LaborTypeID === id);
}
LaborTypes:Array=[];
public GetLaborTypeDesc(id:number):任意{
返回this.LaborTypes.find(x=>x.LaborTypeID==id);
}
我的网格中有添加、编辑和删除命令,这些命令涉及到此处未看到的表单。我还在我的
ngOnInit
函数中填充LaborTypes
对象数组,因此用户可以在下拉列表中选择选项。查看KendoUI网格文档。