We just wrapped up AG Studio Launch Week See what we shipped




Core Features

Advanced Features

JavaScript Data GridAG Grid Error #36

Full Error Text

`colDef.type` `<type>` does not correspond to defined `gridOptions.columnTypes`
To show this error text in the dev console, enable development validations .

Column Type Not Defined Copy Link

A column asked for the type <type> and the grid found no definition under that name, so it was skipped. The column keeps its other properties, and any other types on it still apply.

Column types are declared once in the columnTypes grid option and referenced by name from a column:

const currencyFormatter = (params) => (params.value == null ? '' : `£${params.value.toLocaleString()}`);
const gridOptions = {
    columnTypes: {
        currency: {
            width: 150,
            valueFormatter: currencyFormatter,
        },
    },

    columnDefs: [{ field: 'boughtPrice', type: 'currency' }],

    // other grid options ...
}

See Column Types.

Check the name Copy Link

Each name is looked up on its own, so one wrong name does not stop the rest working — which is why the grid can name a type when the definition looks present:

  • type accepts one name, several as a comma-separated string, or an array. type: 'currency, shaded' and type: ['currency', 'shaded'] are equivalent, and each is resolved separately.
  • Only numericColumn and rightAligned are provided by the grid. Every other name has to be in columnTypes.
  • Cell data types are a different mechanism. 'number', 'date', 'text' and the rest belong to cellDataType, not type. See Cell Data Types.

Check where the type came from Copy Link

The type need not be written on the column the message names. The grid takes the first of these it finds:

  1. type on the column definition.
  2. The columnTypes of a cell data type definition, applied to every column using that data type.
  3. type on the defaultColDef, applied to every column.

So a type named on defaultColDef or a custom data type reports against columns you never set a type on, once for each of them.

Check columnTypes is a grid option Copy Link

columnTypes sits alongside columnDefs at the grid level, not inside a column definition. Declaring it on a column, or on defaultColDef, leaves the grid with no definitions to resolve against.

A column type cannot set type itself (error #35), and cannot reuse a provided name such as numericColumn (error #34).

The following documentation pages should provide additional context / guidance on how to resolve this error.