Flexmonster - customizeCell - removing totals and subtotals for one measure
HTML
<script src="https://s3.amazonaws.com/flexmonster/2.2/flexmonster.js"></script>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://s3.amazonaws.com/flexmonster/2.3/flexmonster.js"></script>
<button onclick="clearCustomizing()">Clear Customizing</button>
<button onclick="startCustomizing()">Start Customizing</button>
<div id="pivot-container"></div>
JavaScript
var pivot = $("#pivot-container").flexmonster({
componentFolder: "https://s3.amazonaws.com/flexmonster/2.3/",
width: "100%",
height: 430,
toolbar: true,
customizeCell: customizeCellFunction,
report: {
"dataSource": {
"data": getData()
},
"slice": {
"rows": [
{"uniqueName": "Year"},
{"uniqueName": "Month"},
{"uniqueName": "Day"}
],
"columns": [
{"uniqueName": "[Measures]"}
],
"measures": [
{"uniqueName": "Balance", "aggregation": "sum"},
{"uniqueName": "Other Value", "aggregation": "sum"}
],
"expands": {
"rows": [
{
"tuple": [
"year.[2017]"
]
},
{
"tuple": [
"year.[2017]",
"month.[january]"
]
}
]
}
}
}
});
function customizeCellFunction(html, data) {
if (data.isTotal == true && data.measure && data.measure.name == "Balance") {
return "";
}
}
function preventExpand(e) {
e.stopImmediatePropagation();
}
function clearCustomizing() {
pivot.customizeCell(null);
}
function startCustomizing() {
pivot.customizeCell(customizeCellFunction);
}
function getData() {
return [{
"Year": "2017",
"Month": "January",
"Day": "01",
"Balance": 100,
"Other Value": 1
}, {
"Year": "2017",
"Month": "January",
"Day": "02",
"Balance": -200,
"Other Value": 2
}, {
"Year": "2017",
"Month": "January",
"Day": "03",
"Balance": 120,
"Other Value": 3
}];
}