The grid options below display the data as expected. But If I try to to format the row.entity[col.field]
value in my cellTemplate, I don't get any data returned.
Code:
$scope.gridOptions = {
enableSorting: true,
columnDefs: [
{name: 'Award Title', field: 'projectTitle', minWidth: 100 },
{name: 'Amount', field: 'awardAmount', cellTemplate: '<div>{{Number(row.entity[col.field]).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')}}
]
};
Any guidance on how to format the column as currency is appreciated.
Thanks.
You can use 'currency' cellFilter to format your data.
$scope.gridOptions = {
enableSorting: true,
columnDefs: [
{name: 'Award Title', field: 'projectTitle', minWidth: 100 },
{name: 'Amount', field: 'awardAmount', cellFilter: 'currency' }}
]
};