I'm facing an issue with my kendoGrid setup. Here's the problem: I have a 0 in my database, but when I use kendo.tostring in the template for kendoGrid, it doesn't display the 0. However, when I have 0.2, the kendo.tostring displays 0.2. How can I make it display only 0?
Here is my JavaScript code:
$("#tab_intensite").kendoGrid({
dataSource: intensite_data,
scrollable: true,
sortable: true,
pageable: false,
detailInit: function(e) {
$("<div/>").appendTo(e.detailCell).kendoGrid({
dataSource: {
data: intensite,
filter: {
field: "idDepart",
operator: "eq",
value: e.data.idDepart
}
},
columns: [{
field: "intituledep",
title: "DÉSIGNATION"
}]
});
},
editable: true,
height: 400,
change: function() {
console.log($this);
$this.attr("font-weight", "bold");
},
save: function() {
$("#tableau_saisie_intensite").data("kendoGrid").dataSource.update;
$("#tableau_saisie_intensite").data("kendoGrid").refresh();
$("#tableau_saisie_intensite").data("kendoGrid").dataSource.bind("change", function(e) {
setdatasourcessss();
});
},
columns: [{
field: "cel",
title: "DÉPART",
width: 50,
headerAttributes: {
style: "text-align: center;"
}
}, {
field: "date_releve",
title: "Date Relevé",
width: 50,
format: "{0:dd/MM/yyyy }",
attributes: {
style: "text-align: center;"
},
headerAttributes: {
style: "text-align: center;"
},
footerTemplate: "<div id='date_intensite_total' style='width:98%;position:relative;text-align: center;' ></div> "
}, {
field: "n",
title: "N",
width: 50,
attributes: {
style: "text-align: center;"
},
footerTemplate: "#= kendo.toString(sum, 'n') # A",
template: "#= (n) ? kendo.toString(n)+ ' A': ''# <span style='float: right;' class='k-icon k-edit'></span>",
headerAttributes: {
style: "text-align: center;"
}
}, {
field: "ph1",
title: "PH1",
width: 50,
attributes: {
style: "text-align: center;"
},
footerTemplate: "#= kendo.toString(sum, 'n') # A",
template: "#= (ph1) ? kendo.toString(ph1, 'n')+ ' A': ''# <span style='float: right;' class='k-icon k-edit'></span>",
headerAttributes: {
style: "text-align: center;"
}
}, {
field: "ph2",
title: "PH2",
width: 50,
attributes: {
style: "text-align: center;"
},
footerTemplate: "#= kendo.toString(sum, 'n') # A",
template: "#=(ph2) ?kendo.toString(ph2)+ ' A': ''# <span style='float: right;' class='k-icon k-edit'></span> ",
headerAttributes: {
style: "text-align: center;"
}
}, {
field: "ph3",
title: "PH3",
width: 50,
attributes: {
style: "text-align: center;"
},
footerTemplate: "#= kendo.toString(sum, 'n') # A",
template: "#=(ph3) ?kendo.toString(ph3, 'n')+ ' A' : ''# <span style='float: right;' class='k-icon k-edit'></span>",
headerAttributes: {
style: "text-align: center;"
}
}],
});
If anyone has suggestions or solutions, they would be greatly appreciated! Thank you in advance!!