pranjal-goswami / multifact-pivottable

A JavaScript plugin for PivotTable.js. It renders multiple aggregations simultaneously with added configurations for rendering beautiful tables http://pranjalgoswami.in/multifact-pivottable/examples/index.html
MIT License
18 stars 13 forks source link

How to hide the Total band while using the multifact-pivottable? #21

Open rsrajan75 opened 2 months ago

rsrajan75 commented 2 months ago

Your addin - multifact-pivottable is working like a charm. Many thanks to the team.

I'm trying to add few total columns by hiding the existing one(s). Please help me with a sample code. I've searched your git samples/existing issues, couldn't find similar kind of.

var prodMap = { 'agg1': { aggType: 'Sum', arguments: [programList[0]], //'P932F' name: 'A', varName :'a', hidden : true, renderEnhancement : 'none' }, 'agg2': { aggType: 'Sum', arguments: [programList[1]], //'P931F' name: 'B', varName :'b', hidden : true, renderEnhancement : 'none' }, 'agg3': { aggType: 'Sum', arguments: [programList[2]], //'P932R' name: 'C', varName :'c', hidden : true, renderEnhancement : 'none' }, };

var prodAggregations = [ { name : programList[0] + ' O/U ' + programList[1], description : 'Over/Under 2', expression : 'variables.a - variables.b', renderEnhancement : 'table', formatterOptions : { digitsAfterDecimal: 0, } }, { name : programList[0] + ' O/U ' + programList[2], description : 'Over/Under 2', expression : 'variables.a - variables.c', renderEnhancement : 'table', formatterOptions : { digitsAfterDecimal: 0, } }, ];

var customAggs = {}; customAggs['Production'] = $.pivotUtilities.multifactAggregatorGenerator(prodMap, prodAggregations);

var renderers = $.extend($.pivotUtilities.renderers, $.pivotUtilities.export_renderers,$.pivotUtilities.gtRenderers);

var config = { autoSortUnusedAttrs: true, "cols": ["Program", "Projected Year"], "rows": ["Vehicle", "Entity"], "vals": [], "rowOrder": "key_a_to_z", "colOrder": "key_a_to_z", "aggregatorName": "Production", renderers: renderers, "rendererName": "GT Table", "rendererOptions" : { aggregations : { defaultAggregations : customAggs, } } };

$("#my-pivot").pivotUI(csvContent, config, true);

//Tried with Jquery but columns not hiding $(document).ready(function() { $('#my-pivot > table > tbody > tr:nth-child(2) > td.pvtRendererArea > table > tbody > tr:nth-child(1) > th.pvtMeasureTotalLabel').hide(); });

Any help is much appreciated. Thanks.