我创建了以下kendo-grid
:
我要实现的是:每当我更改货币select
选项时,我都希望在该行中更改货币 ONLY (仅),这样我就可以拥有多个货币条目在我的网格下面。我找到了文档here,并尝试了完全相同的代码,但是我意识到,每次更改option
时,Web应用程序中的整个文化都会发生变化。
以下是一些代码:
debts.component.html
<kendo-grid #creditorsGrid
id="creditorsGrid"
[data]="gridData"
...>
<ng-template kendoGridToolbarTemplate>
...
</ng-template>
<kendo-grid-column field="ID" title="Α/Α" width="50"></kendo-grid-column>
<kendo-grid-column field="CreditorName" title="Πιστωτής">
<ng-template kendoGridCellTemplate let-dataItem="dataItem">
<kendo-combobox [data]="creditorsListItems" [suggest]="true"></kendo-combobox>
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="Amount" title="Ποσό" editor="numeric" format="{0:c}"></kendo-grid-column>
<kendo-grid-column field="Currency" title="Νόμισμα" width="100">
<ng-template kendoGridCellTemplate let-dataItem="dataItem">
<select style="width:65px" [value]="localeId" (change)="onLocaleChange($event.target.value)">
<option value="en-DE">€</option>
<option value="en-GB">£</option>
<option value="en-CH">Fr.</option>
<option value="en">$</option>
</select>
</ng-template>
</kendo-grid-column>
<kendo-grid-command-column width="100">
...
</kendo-grid-command-column>
</kendo-grid>
debts.compoenent.ts
export class DebtsComponent implements OnInit {
constructor(private formBuilder: FormBuilder, public editService: EditService,
public intlService: IntlService, private localeService: LocaleService) { }
public get localeId(): string {
return this.localeService.localeId;
}
public onLocaleChange(locale: string): void {
this.localeService.set(locale);
}
}
(localeService
在我上面提到的文档页面中找到)。预先感谢!
答案 0 :(得分:1)
如果您将货币设为Enum类型,则应该可以为每种货币选择该Enum。不确定这是否是您要寻找的东西,我做了与kendo MVC中类似的事情。