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 columnTypes = useMemo(() => {
return {
currency: {
width: 150,
valueFormatter: currencyFormatter,
},
};
}, []);
const [columnDefs, setColumnDefs] = useState([{ field: 'boughtPrice', type: 'currency' }]);
<AgGridReact
columnTypes={columnTypes}
columnDefs={columnDefs}
/>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:
typeaccepts one name, several as a comma-separated string, or an array.type: 'currency, shaded'andtype: ['currency', 'shaded']are equivalent, and each is resolved separately.- Only
numericColumnandrightAlignedare provided by the grid. Every other name has to be incolumnTypes. - Cell data types are a different mechanism.
'number','date','text'and the rest belong tocellDataType, nottype. 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:
typeon the column definition.- The
columnTypesof a cell data type definition, applied to every column using that data type. typeon thedefaultColDef, 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.