简体   繁体   中英

can't change kendo grid column formatting number from 2.666666 to 2.66 ( decimal placeholder 0:0.00)

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?

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 },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM