我试图用angular2来概括制作Telerik Grid。在我的组件中我有:
# your existing code
dwg = ezdxf.readfile('path_to_my_file.dxf')
for layer in dwg.layers:
if layer.dxf.name == 'old_layer_name':
layer.dxf.name == 'new_layer_name'
# this is the part that's untested
for entity in dwg.entities:
if entity.layer.dxf.name == 'old_layer_name':
entity.layer.dxf.name == 'new_layer_name'
正确获取数据(我试过没有案例并且工作正常) 然后在我的模板html:
private cols: Column[] = [
{ name: 'id', desc: 'ID' },
{ name: 'listen', desc: 'Listen' },
{ name: 'station', desc: 'Station' },
{ name: 'location', desc: 'Location' },
{ name: 'type', desc: 'Type' },
];
我想为每列应用不同的处理。在ngFor模板之后如何在这种情况下应用ngSwitch。我试过几种方式,比如添加<kendo-grid [data]="gridPager">
<template *ngFor="let col of cols" let-col>
</template>
</kendo-grid>
或
<span [ngSwitch]="col.name", {{"col.name"}}
但无济于事。
答案 0 :(得分:0)
我终于找到了方法,并为其他人发帖。
<template ngFor [ngForOf]="cols" let-col>
<kendo-grid-column field="{{col.name}}" title="{{col.desc}}" [ngSwitch]="col.name" [sortable]="col.name!='listen'">
<template kendoGridCellTemplate let-dataItem let-column *ngSwitchCase="'listen'">
<button kendoButton (click)="open(dataItem) " style="width:180">{{dataItem.station.text}}</button>
</template>
<template kendoGridCellTemplate let-dataItem let-column *ngSwitchCase="'station'">
<a href="{{dataItem.station.href}}" target="_new">{{dataItem.station.text}}</a>
</template>
</kendo-grid-column>
</template>