customTreeAggregationFinalizerFn How to get current tree node ?
customTreeAggregationFinalizerFn : function (aggregation) {
aggregation.rendered = aggregation.value;
}
I just need access to other column aggregation value from this function environment.
I need do something like that:
customTreeAggregationFinalizerFn : function (aggregation) {
aggregation.rendered = row.column["views"].getAgreggationValue() / row.column["amount"].getAgreggationValue() ;
}
But I don't know how to get current row from treeNode or anywhere
The treeBase documentation may help you http://ui-grid.info/docs/#/api/ui.grid.treeBase, particularly the documentation for tree: http://ui-grid.info/docs/#/api/ui.grid.treeBase.grid:treeBase.
Having said this, it looks to me on first glance that the row information is passed into treeAggregationFunctions but not the finalizer. It may be available through this or another such variable - check in your debugger.
I have a solution, but I don't know if its the best..
customTreeAggregationFinalizerFn : function (aggregation) {
aggregation.rendered = aggregation.value2 * 100 / aggregation.value1
}
customTreeAggregationFn : function( aggregation, fieldValue, numValue, row ) {
if(row.entity.A){
if(!aggregation.value1){
aggregation.value1 = parseFloat(row.entity.A);
aggregation.value2 = parseFloat(row.entity.B);
} else{
aggregation.value1 += parseFloat(row.entity.A);
aggregation.value2 += parseFloat(row.entity.B) ;
}
}
}
I just add a personalized aggregation values to aggregation object. Because I couldn't found te ui-grid aggregation value from treeNode