-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to format the value of a grid column as USD $ currency? #5951
Comments
Hello @brookhutchinson , |
You mention that I need to add the IgxCell directive to a column that I want to format as currency. The second column in your sample named "Price" looks like it is formatting the value as currency, but does not have an igxCell directive or a |
If you want to add any custom mark up, provide some additional logic or to format the cell value, you can define a custom cell template. Like in the snippet below: <igx-column field="TestField" header="Value" width="100" [dataType]="'number'">
<ng-template IgxCell let-cell='cell'>
<div class='sampleClass'> // this is just sample. You can omit the div in your use case
$ {{ cell.value }}
</div>
</ng-template>
</igx-column> If you just need to format the cell value you can just use the column formatter property, as you see in the sample that I linked below. |
How can I format the value of a column to $ USD currency with no numbers after decimal place and allow the user to be able to click a column header to sort the currency values in ascending order or descending order? |
As mentioned above, you can use either the cell template functionality or the column formatter property. You can see them in action here |
Question
How do I format the value of a grid column as USD $ currency?
For some reason every other row in the grid is not immediately displaying the column value. Instead a user has to hover over the missing row column value and then the value displays.
Here is the code that I am using for my grid column
<igx-column field="annual_credit_value" header="Annual Value" width="100" [dataType]="'number'" [disableHiding]="false" [disablePinning]="false" [filterable]="true" [movable]="false" [resizable]="true" [sortable]="true"> <ng-template let-value> {{ value | currency: 'USD': 'symbol': '1.0-0' }} </ng-template> </igx-column>
The text was updated successfully, but these errors were encountered: