无法将剑道网格列格式数字从 2.666666 更改为 2.66(小数占位符 0:0.00)



halo guys我不能改变格式编号为十进制占位符(从2.66666到2.66),我准备把格式,但它没有改变。'

$("#grid").kendoGrid({
dataSource: settingModel.ds_grid_dataSource,
resizable: "true",
editable: "inline",
scrollable: "true",
sortable: "true",
filterable: "true",
pageable: "true",
height: "500px",
columns: [
{ field: 'NRP', title: 'NRP', width: 80 },
{ field: 'NAMA', title: 'Name', width: 100 },
{ field: 'NAMA_PEKERJAAN', title: 'Pekerjaan', width: 100 },
{ field: 'AVG_AP', title: 'Nilai', format: '{0:0.00}', width: 50 }, //this is my column that i want to change format number
{ title: 'Pilih', template: $('#tmp_check').html(), width: 30 },
]
}).data("kendoGrid");
这是我的截图输入图片描述

你们能帮帮我吗?

在您的数据源中,AVG_AP是一个数字吗?如果它是一个字符串,那么format将不起作用。

要么更改数据源,使AVG_AP属性为数字,要么将其从字符串转换为浮点数,并将其四舍五入到小数点后2位:

{ field: 'AVG_AP', title: 'Nilai', template: "#:(Math.round(parseFloat(AVG_AP) * 100) / 100).toFixed(2)#", width: 50 },

最新更新