I am using adaptable grid/ ag grid in my application,
table looks like-
Finance | May 2020 | May 2021
revenue |23 | 22
tax | | 21
Now If I dont pass data for may 2020 tax grid automatically renders empty cell, But I want this to be custom, I want to display ‘-
2
Answers
You can use a custom cell renderer and do this :
cellRenderer: (params) => (params.value) ? params.value : ‘-‘;
https://www.ag-grid.com/react-data-grid/component-cell-renderer/
You can utilize a function alongside the valueFormatter in your column definitions. Here’s a brief example to illustrate this:
In this function, you’ll automatically receive params from the valueFormatter of the column. The function checks if params contains a value and returns that value. If no value is present, it returns a dash ("-").
To apply this function to a column, you can use it in your column definition like so:
With this setup, your row data will render the value of the column or a dash ("-") if the value is not available.