How to set default value on cells using Ag Grid

Viewed 3702

I have rows of data and some columns may be empty. I want to insert a - on columns with no data. Is there a way to place default value of cells if no data is returned for that column?

Something like this?

columnDefs: [
    {name: 'ColumnA', field: 'columnA', default: '-'}
]

I've tried this and it didnt work:

columnDefs: [
    {name: 'ColumnA', 
    field: 'columnA', 
    valueSetter: params=>{
       if(params.value === ''){
          return '-'
        }
    }}
]
1 Answers
columnDefs: [
    {name: 'ColumnA', 
    field: 'columnA', 
    valueFormatter: params=>{
       if(params.value === ''){
          return '-'
        }
    }}
]
Related