I am using Kendo and i want to format a number with spaces (in my grid columns) like this example: 123456789 to 123 456 789 But i didnt find this format
is some one know it?
I am using Kendo and i want to format a number with spaces (in my grid columns) like this example: 123456789 to 123 456 789 But i didnt find this format
is some one know it?
To format the number with spaces as the thousands separator, you can use the answer from here: How to print a number with commas as thousands separators in JavaScript
Assuming no decimals:
function numberWithSpaces(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
Then your column definition would be
{
field: "Especes",
title: "Hello",
template: function(dataItem) {
return "<span>" + numberWithSpaces(dataItem.Especes) + "</span>"
}
}