Home > other >  can't change kendo grid column formatting number from 2.666666 to 2.66 ( decimal placeholder 0:
can't change kendo grid column formatting number from 2.666666 to 2.66 ( decimal placeholder 0:

Time:12-19

halo guys i can't change format number to decimal placeholder (from 2.66666 to 2.66), i ready to put the fromat but it not change. `

$("#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");

this is my screenshot enter image description here

Can you guys help me?

CodePudding user response:

In your datasource, is AVG_AP a number? If it is a string then format will not work.

Either change the datasource so that the AVG_AP property is a number or template it to convert it from string to float and round to 2 decimal places:

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