The template is what will be rendered in the cell, it does not affect the real data operations nor the real data.
Depending on the available information (data attributes and column configuration), you can return the original calculations or the custom ones - that’s the main idea.
Template itself receives the following parameters:
template = function(obj, common, cellValue, colConfig, itemIndex){}
Perhaps, the most useful here the $parent, $level, $count and $source (the last is available only in stableRowId mode) attributes in each aggregated data item (obj
in template).
For example
// percentage for the top level only
template:function(obj, common, cellValue, colConfig){
return !obj.$parent ? getAggregator(...) : cellValue;
}
However, about operations: column ID includes all required information regarding the structure:
colLevel1_'_/* . . . */_'_colLevelN_'_operation_'_value
Apart from the first column, the operation can be obtained from the configuration:
var head = columns[i].header; // array of header lines
// last line contains value/operation/text
var operation = head[head.length-1].operation;