webix Formatting whole numbers

Hi

I have the below code

var grid2 = {
view:"datatable",
columns:[
{ id:"title",   header:["Film title",{ content:"multiComboFilter" }] , fillspace:true},
{ id:"year",    header:["Released"]},
{ id:"votes",   header:"price",format:window.webix.Number.numToStr({
groupDelimiter:",",
groupSize:3,
decimalDelimiter:".",
decimalSize:5
}), width:100 },
{ id:"rating",  header:"Rating",    width:100}
],
scrollX:false,
select:"cell",
data: [
    { id:1, title:"The Shawshank,Redemption", year:1994, votes:678790.12, 
rank:1},
{ id:2, title:"The Godfather", year:1972, votes:511495.11, rank:2},
 { id:3, title:"Jaws", year:1998, votes:511495, rank:3}
]
};

webix.ui({
padding:10,
margin:10,
rows:[
{view:"label", label:"Multi-select filter in the DataTable"},
grid2
]

});

for the movie jaws since the votes are whole number i dont want to display zeros after decimal .i just wanted to display the no of votes as it is i.e 511495

But for other movies i wanted to display the decimal number but for this i have my code working .but for movie jaws i am not able to get the number

How can i do this?

hi

Can anybody help pls

@Listopad

Can you help me pls…?

try to add this template to the column config

template: function(obj, common, formatted){
      if(/\\.00000$/.test(formatted)){
        formatted = formatted.substr(0, formatted.length-6)
      }
      return formatted
    } 

@integral

Thanks for the help

Also i wanted to remove the zeros after decimal

Example if the number is 13.44000 i wanted to display only 13.44 only but by default zeros are getting added.

how can i do this?

template: function(obj, common, formatted){
      return (formatted||"").toString().replace(/\\.?0+$/, '')
    }