JavaScript Data Grid

Parsing Values

javascript logo

After editing cells in the grid you have the opportunity to parse the value before inserting it into your data. This is done using Value Parsers.

Value Parser

For example suppose you are editing a number using a text editor. The result will be a string, however you will probably want to store the result as a number. Use a Value Parser to convert the string to a number.

const gridOptions = {
    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)

    // other grid options ...