How to format a number value in AngularJS ui-grid cell to two decimal?
21,028
You can use the columnDefs cellFilter option:
columnDefs: [
{
field: 'name',
cellFilter: 'number: 2'
}
]
Author by
Tony
Updated on July 09, 2022Comments
-
Tony almost 2 years
I'm using Angularjs ui-grid and using the default settings, the question is how can I format the numbers to two decimal?
-
Jack Song about 8 yearsThe question specifically asked, how to format a number value in Angular ui-grid, which requires a custom filter. While this answer is technically correct for general JavaScript usage, it is not an appropriate answer for this question.
-
Varun about 8 yearsHow to display 0 to 0.00 in ui-grid ?
-
Adrew over 7 yearsWhen I try to export my ui-grid as a pdf, the numbers still show multiple decimal points. Do you know of a way I can export my uigrid as a pdf with the data only showing two decimal?