'Kendo grid column number formatting

How to set number formatting in kendo column if we bind 2 data values? In my example I have to bind value with unit, so I need a value written with 2 decimals. My code looks like:

{
    field: "Quantity",
    title: "Value ",
    width: "70px",
    type: "number",
    format:"{0:n2}",
    template: "#:Quantity# #:Unit#",
    attributes:{style:"text-align:right;"}
},

Without binding it to unit it works great, but with unit I have a problem. Thanks in advance



Solution 1:[1]

Above given answer is fine but you can also achieve the same result by using separate kendo templates for more customization options.

template: kendo.template($("#quantity-tmplt").html())

Define your template.

<script type="text/x-kendo-template" id="quantity-tmplt">
    <div>#= kendo.toString(Quantity, "n2") #</div>
</script>

For more information, read KendoGrid Column Template

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 habib