diff --git a/DESCRIPTION b/DESCRIPTION index 043ebca..cd55bdd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: rpivotTable Title: Build Powerful Pivot Tables and Dynamically Slice & Dice your Data Date: 2018-01-29 -Version: 0.3.0 +Version: 0.3.1002 Authors@R: c( person("Enzo", "Martoglio", role = c("aut", "cre"), email = "enzo@smartinsightsfromdata.com"), person("Nicolas", "Kruchten", role = c("ctb", "cph"), email = "nicolas@kruchten.com"), diff --git a/inst/htmlwidgets/rpivotTable.js b/inst/htmlwidgets/rpivotTable.js index e3c7e82..bab64ce 100755 --- a/inst/htmlwidgets/rpivotTable.js +++ b/inst/htmlwidgets/rpivotTable.js @@ -34,6 +34,13 @@ HTMLWidgets.widget({ x.params.dataClass = $.pivotUtilities.SubtotalPivotData; } + if (Array.isArray(x.params.aggregators) && x.params.aggregators.length == 1) { + x.params.aggregators = Function('"use strict";return (' + x.params.aggregators[0] + ')')() + } + if (Array.isArray(x.params.renderers) && x.params.renderers.length == 1) { + x.params.renderers = Function('"use strict";return (' + x.params.renderers[0] + ')')() + } + $('#'+el.id).pivotUI(x.data, x.params, true, x.locale); } });