Getting Started

Setup

Tutorials

Compatibility & Security

AI Features
Layout & Styling

Theming

Charting

Sparklines

Integrated Charts

Standalone Charts

Core Features

Columns

Rows

Cells

Filtering

Selection

Editing

Updating Data

Interactivity

Advanced Features

Row Grouping

Aggregation

Pivoting

Tree Data

Master Detail

Accessories

Server-Side Data

Import & Export

State & Lifecycle

Performance

Value Parser

<ag-grid-angular
    [columnDefs]="columnDefs"
    /* other grid options ... */ />

this.columnDefs = [\
    {\
        // name is a string, so don't need to convert\
        field: 'name',\
        editable: true,\
    },\
    {\
        // age is a number, so want to convert from string to number\
        field: 'age',\
        editable: true,\
        valueParser: params => Number(params.newValue)\
    }\
];
valueParser
string

Below shows an example using value parsers. The following can be noted:

  • All columns are editable. After any edit, the console prints the new data for that row.
  • Column 'Name' is a string column. No parser is needed.
  • Column 'Bad Number' is bad because after an edit, the value is stored as a string in the data, whereas the data value should be number type.
  • Column 'Good Number' is good because after an edit, the value is converted to a number using the value parser.

Use Value Parser for Import

Using the value parser for import applies to the following features:

Using a value parser for import is normally used in conjunction with Using a Value Formatter for Export, where a Value Formatter is defined that does the reverse of the value parser.