Customize collapsed and expanded cells
Customizing the grid
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="clearCustomizing()">Clear Customizing</button>
<button onclick="startCustomizing()">Start Customizing</button>
<div id="pivot-container"></div>
CSS
@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);
JavaScript
let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
customizeCell: customizeCellFunction,
report: {
"dataSource": {
"filename": "data/data.json"
},
"slice": {
"rows": [{
"uniqueName": "Country"
}, {
"uniqueName": "Color"
}],
"columns": [{
"uniqueName": "Category"
}, {
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "Price",
"aggregation": "sum"
}]
}
}
});
function customizeCellFunction(cell, data) {
if (cell.text &&
(cell.text.indexOf("fm-collapsed") > -1 ||
cell.text.indexOf("fm-expanded") > -1)) {
cell.style["background-color"] = "yellow";
}
}
function clearCustomizing() {
pivot.customizeCell();
}
function startCustomizing() {
pivot.customizeCell(customizeCellFunction);
}