在 ng-template 中使用 kendo-grid-column 的格式 属性?
Using format property of kendo-grid-column in ng-template?
kendo-grid-column
有很棒的专栏 属性 'format'。并且 it works perfectly.
<kendo-grid [data]="gridData">
<kendo-grid-column field="UnitPrice" title="Unit Price" format="{0:n0}">
<ng-template kendoGridCellTemplate format="{0:n0}" let-dataItem>
<a href="#" class="badge badge-info">{{ dataItem?.UnitPrice }}</a>
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="UnitPrice" title="Unit Price" format="{0:n0}">
</kendo-grid-column>
</kendo-grid>
我需要的是添加锚标签并使用format
属性 of kendo-grid-column
。所以我将 ng-template
添加到 kendo-grid-column
:
<kendo-grid-column field="UnitPrice" title="Unit Price" format="{0:n0}">
<ng-template kendoGridCellTemplate format="{0:n0}" let-dataItem>
<a href="#" class="badge badge-info">{{ dataItem?.UnitPrice }} </a>
</ng-template>
</kendo-grid-column>
但是,format="{0:n0}
在 ng-template
中不起作用:
<ng-template kendoGridCellTemplate format="{0:n0} let-dataItem>
<a href="#" class="badge badge-info">{{ dataItem?.UnitPrice }} </a>
</ng-template>
我创建了 an example to show what I have。
是否可以在 ng-template
中使用 format
属性 of kendo-grid-column
?
你应该使用Kendo数字格式化函数,例如
kendo.toString(10.12, "n5"); //10.12000
或者只使用 Kendo IntlService:
的方法
- 格式编号()
- parseNumber()
- 格式()
使用 internationalization pipe. I found the answer here.
<kendo-grid-column field="UnitPrice" title="Unit Price" format="{0:n0}">
<ng-template kendoGridCellTemplate format="{0:n0}" let-dataItem>
<a href="#" class="badge badge-info">{{ dataItem?.UnitPrice | kendoNumber: 'n0' }} </a>
</ng-template>
</kendo-grid-column>
kendo-grid-column
有很棒的专栏 属性 'format'。并且 it works perfectly.
<kendo-grid [data]="gridData">
<kendo-grid-column field="UnitPrice" title="Unit Price" format="{0:n0}">
<ng-template kendoGridCellTemplate format="{0:n0}" let-dataItem>
<a href="#" class="badge badge-info">{{ dataItem?.UnitPrice }}</a>
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="UnitPrice" title="Unit Price" format="{0:n0}">
</kendo-grid-column>
</kendo-grid>
我需要的是添加锚标签并使用format
属性 of kendo-grid-column
。所以我将 ng-template
添加到 kendo-grid-column
:
<kendo-grid-column field="UnitPrice" title="Unit Price" format="{0:n0}">
<ng-template kendoGridCellTemplate format="{0:n0}" let-dataItem>
<a href="#" class="badge badge-info">{{ dataItem?.UnitPrice }} </a>
</ng-template>
</kendo-grid-column>
但是,format="{0:n0}
在 ng-template
中不起作用:
<ng-template kendoGridCellTemplate format="{0:n0} let-dataItem>
<a href="#" class="badge badge-info">{{ dataItem?.UnitPrice }} </a>
</ng-template>
我创建了 an example to show what I have。
是否可以在 ng-template
中使用 format
属性 of kendo-grid-column
?
你应该使用Kendo数字格式化函数,例如
kendo.toString(10.12, "n5"); //10.12000
或者只使用 Kendo IntlService:
的方法- 格式编号()
- parseNumber()
- 格式()
使用 internationalization pipe. I found the answer here.
<kendo-grid-column field="UnitPrice" title="Unit Price" format="{0:n0}">
<ng-template kendoGridCellTemplate format="{0:n0}" let-dataItem>
<a href="#" class="badge badge-info">{{ dataItem?.UnitPrice | kendoNumber: 'n0' }} </a>
</ng-template>
</kendo-grid-column>