The default way to get a value from a cell is provide a field value to the grid. However that may not always be possible. If you need more control over how a value is calculated, then use Value Getters.
A value getter is either a function or an expression for getting the value for a cell. The result of the value getter is then forwarded to the cell renderer for rendering. Thus it is possible to have a value getter for example calculating a total of columns, and then a cell renderer for rendering currency, that renders decoupled from how the value is generated.
The parameters provided to valueGetters are as follows:
The parameters to the value getter are similar to that of cellRenderers except with the following
a) No value - as it's the valueGetters responsibiliy to create the value).
b) No rowIndex - as the value should exist outside the concept of rendering to a particular row - for example, the valueGetter could be called for a row that is not being rendered.
Value getter functions are similar to value renderers in their operation, in that you provide the value getter function as a function attached to the column definition.
The example below uses a valueGetter function for calculating the 'Age Now' column.
Value getter expressions work in the same was as functions, except you pass an expression. The expression has access to the same attributes as the function which are:
Headers can also have values that change or are dependent on some extra data. For example, you might have a column that has the name of the current calendar month, and changes depending on what month the report is looking at.
As with cell valueGetters, a headerValueGetter can be a function or an expression. It is provided with the parameters:
If you want to update the columns (say after a change in the data which requires a new column name) then get the grid to update by calling api.refreshHeader().