Skip to content

Infragistics Community Forum / Web / Ignite UI for jQuery / How to format an integer column without comma in IgGrid?

How to format an integer column without comma in IgGrid?

New Discussion
Dean
Dean asked on Jul 23, 2013 6:37 PM

How can I format an integer column without comma separator?

Sign In to post a reply

Replies

  • 0
    [Infragistics] Troy Rodda
    [Infragistics] Troy Rodda answered on Jul 15, 2013 7:53 PM

    Hi Dean,

    This is an initial update to let you know that I have received your inquiry. I will look into this for you and will have an update on or before Thursday.

     

    • 0
      [Infragistics] Troy Rodda
      [Infragistics] Troy Rodda answered on Jul 18, 2013 7:52 PM

      Hi Dean,

      For this you can use the ‘format’ option which you can set on the colum. The ‘format’ option applies for number datatypes and can be set to format as a’number; currency; percent; int; double, etc. You set it like this:

      columns: [

              { headerText: "Product ID", key: "ProductID", dataType: "number", format: "number" },
              { headerText: "Production Date", key: "ProductionDate", dataType: "date", format: "ddd, MMM-d-yy HH:mm" },
         
      You can see more on this by referencing tbe API (help.infragistics.com/jQuery/2013.1/ui.iggrid)–> Options -> Columns -> Format
      Let me know if you need any additional assistance.
      • 0
        Dean
        Dean answered on Jul 18, 2013 8:16 PM

        Hi Troy,

        Your suggested solution does not works.  Here is the link to the image to show the result. sdrv.ms/18nfL7E

         

        Thanks,

        Dean

      • 0
        [Infragistics] Troy Rodda
        [Infragistics] Troy Rodda answered on Jul 23, 2013 4:24 PM

        Hi Dean,

        Yes, I see the issue…

        What you can do use use a column 'formatter' and strip-out the "," comma seperator.

        For example, you can try the following:

        function formatNumber (val) {    if (typeof val !== "number" || isNaN(val)) {        return "Not set";    }    return "$" + val.toString().replace(/\,/g,'');    

         }

           …..and then set the formatter in your column settings:

           columns: [ { headerText: "Number", key: "Number", formatter: formatNumber} ]

         

        This should do the trick to strip out the comma from the integer column. Let me know if you need any additional assistance.

        Thanks!

                

         

      • 0
        Dean
        Dean answered on Jul 23, 2013 5:49 PM

        Formatter approach does not work either. The val variable is a number type so there is no comma to strip even if you toString the value.

        sdrv.ms/12zjR8i

      • 0
        Dean
        Dean answered on Jul 23, 2013 6:33 PM

        I found a solution. Just remove dataType and format.

        { headerText: 'Id', key: 'ID', width:'50px' }

      • 0
        [Infragistics] Troy Rodda
        [Infragistics] Troy Rodda answered on Jul 23, 2013 6:37 PM

        Hi drchip,

        I am pleased to see that you found a solution.  Let us know if you need any additional assistance!

        Thanks!

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Dean
Favorites
0
Replies
7
Created On
Jul 23, 2013
Last Post
12 years, 10 months ago

Suggested Discussions

Created by

Created on

Jul 23, 2013 6:37 PM

Last activity on

Feb 11, 2026 2:19 PM