Skip to content

Infragistics Community Forum / Web / Ignite UI for Angular / Show Full Decimal Precision in IgxGrid Number Columns

Show Full Decimal Precision in IgxGrid Number Columns

New Discussion
Shobhana Suara
Shobhana Suara asked on Apr 7, 2020 6:42 AM

Hi,

I am using igx Data grid Angular UI. For column with datatype ‘number’ how many decimal places can i display in igx-cell of igx grid. Is there any restriction to display the decimal places. If yes, where can i change?

Sample application: https://stackblitz.com/edit/angular-grid-decimal-places?file=src%2Fapp%2Fdata%2FnwindData.ts

Here, in Unit Price column you can see only 3 decimal places being dispalyed/rendered but when u edit the particular column it has more than 3 decimal places.

I want to display all the decimal places as it is and not to round off the same.

Its quite urgent. Need reply ASAP.

Sign In to post a reply

Replies

  • 0
    Mihoko Kamiishi
    Mihoko Kamiishi answered on Apr 7, 2020 4:16 AM

    Hello Shobhana,

    You can apply number formatting to cells using IgxColumnComponent's formatter function.
    For example, you can display the decimal digits as it appears in the data by setting the formatter function in onColumnInit event as shown below.

    component.html
    ———————-
        <igx-grid ….. (onColumnInit)="onColumnInit($event)">
    …..
        </igx-grid>
    ———————-

    component.ts
    ———————-
    onColumnInit(column: IgxColumnComponent) {
     if(column.field =="UnitPrice")
     {
      column.formatter = (unitPrice => {
         return unitPrice;
      });
     }
    }
    ———————-

    You should also be able to restrict the number of digits to be displayed by formatting the return value using toFixed() method in the formatter function above.

    • 0
      Shobhana Suara
      Shobhana Suara answered on Apr 7, 2020 5:02 AM

      Hello Mihoko,

      Thank you for your reply. Is there any documentation i can refer to. I will try the same and get back to you in case of any questions.

      • 0
        Mihoko Kamiishi
        Mihoko Kamiishi answered on Apr 7, 2020 5:09 AM

        Hello Shobhana,

        This is the document for IgxColumnComponent's formatter property.

        https://www.infragistics.com//angular-docs/typescript/latest/classes/igxcolumncomponent.html#formatter

    • 0
      Shobhana Suara
      Shobhana Suara answered on Apr 7, 2020 6:19 AM

      Still not able to see all the decimal places. I have shared a sample. Can u please make changes and share the resolution so that i can know what wrong am i doing?

      • 0
        Mihoko Kamiishi
        Mihoko Kamiishi answered on Apr 7, 2020 6:34 AM

        I have modified your sample in the link below.

        stackblitz.com/…/angular-grid-decimal-places-d2unvd

      • 0
        Shobhana Suara
        Shobhana Suara answered on Apr 7, 2020 6:42 AM

        Appreciate your fast reply. It worked!! Thank You Mihoko [emoticon:c4563cd7d5574777a71c318021cbbcc8]

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Shobhana Suara
Favorites
0
Replies
6
Created On
Apr 07, 2020
Last Post
6 years, 4 months ago

Suggested Discussions

Created by

Created on

Apr 7, 2020 6:42 AM

Last activity on

Feb 12, 2026 10:24 AM