Search code examples
javascriptangularjsangular-ui-gridui-grid

How to change the value of a column in export csv format in ui grid?


I am using UI grid export functionality to export all grid columns in .csv format. Some columns values are 'FALSE' or '1' / '0' . My question is How can I change them to some strings in exported file?


Solution

  • using http://ui-grid.info/docs/#!/api/ui.grid.exporter.api:GridOptions you can use exporterFieldCallBack method as below:

      gridOptions.exporterFieldCallback = function ( grid, row, col, value ) {
      if ( col.name === 'status' ) {
        if(value===0)
            value='FALSE';
      }
      return value;
    }