我已经基于html表创建了一个kendo网格。我希望网格中的数字只显示2位小数,但我无法弄清楚如何做到这一点。请帮忙。请参阅下面的代码。
<table id='test'>
<tr>
<th data-field='field1' data-type='number' data-template='#= kendo.toString(field1, "n2") #'>
ColumnHeader
</th>
</tr>
<tr>
<td>2.2579</td>
</tr>
</table>
<script>
$(document).ready(function(){
$("#plStatsGrid").kendoGrid({});
});
</script>
答案 0 :(得分:1)
This is a basic scripting error. Your script is looking for table with id plStatsGrid
, but your table has id test
. Working fiddle.
<table id='plStatsGrid'>
<tr>
<th data-field='field1' data-type='number' data-template='#= kendo.toString(field1, "n2") #'>
ColumnHeader
</th>
</tr>
<tr>
<td>2.2579</td>
</tr>
</table>
<script>
$(document).ready(function(){
$("#plStatsGrid").kendoGrid({});
});
</script>