How to format a number value in AngularJS ui-grid cell to two decimal?

Tony picture Tony · May 21, 2015 · Viewed 20k times · Source

I'm using Angularjs ui-grid and using the default settings, the question is how can I format the numbers to two decimal?

enter image description here

Answer

jme11 picture jme11 · May 21, 2015

You can use the columnDefs cellFilter option:

columnDefs: [
  {
    field: 'name',
    cellFilter: 'number: 2'
  }
]