Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
iggrid template format
posted

Hi,

I have this iggrid template:

<script id="ColTmpl" type="text/template">
    <div>
        <span>${column1}</span>
    </div>
</script>

I need to format the number in the form #,###,###.#

How can I do?

Parents
No Data
Reply
  • 200
    Verified Answer
    Offline posted

    Hello Luca,

    Thank you for contacting Infragistics.

    In order to change the format of the number it is better to use the formatter function, rather than template option, because you can write your own custom javascript directly in the function.

    In your case I would recommend using formatter function similar to this:

    formatter: function(val, record) {
        return val.toFixed(1).replace(/\d(?=(\d{3})+\.)/g, '$&,');
    }

    This function uses regex(Regular Expressions) to match the desired format, but you can write your own implementation of formatting the number in the body of the function.

    Additionally I have attached a sample that displays the values of the “number” column in format #,###,###.#

    In case you have additional questions feel free to ask them.

    numberFormatSample.zip

Children