I’m using the ej2 javascript Grid by Syncfusion. The following is a simplification of the actual code.
In the grid definition I have a column having a template, like this :
{ field: "Quantity", headerText: "Quantity", template: "#colQuantity" },
<script id="colQuantity" type="text/x-template">
${quantity}
</script>
What I want to achieve here is to have a format "N4" in the quantity field, so the value is prettier. Is there a way to add a .toFixed(4)
or a format("N4")
somewhere in the template, or a way to rewrite this template so the format is applied?
2
Answers
I found that a template can call a javascript function and pass in data. The following code made it work.
In the columns definition for the grid, in the definition for that column, use something like: