我创建了这个kendo-grid
:
我想要实现的是:每当我更改货币select
选项时,我只想更改该行中的货币,这样我就可以在我的网格下面有多个货币条目。我在这里找到了文档,并尝试了完全相同的代码,但我意识到每次更改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>
债务.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
在我上面提到的文档页面中可以找到)。提前致谢!