JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>
CSS
.notexpandable {
cursor: initial;
}
JavaScript
let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
"dataSource": {
"filename": "data/data.json"
},
"options": {
"showReportFiltersArea": true,
"showAllFieldsDrillThrough": true,
"configuratorButton": true,
"showDrillThroughConfigurator": true,
"showFieldListSearch": true,
"allowBrowsersCache": true,
"grid": {
"type": "classic",
"title": "Ledger Details & Export",
"showFilter": true,
"showHeaders": false,
"showTotals": "off",
"showGrandTotals": "off"
}
},
"slice": {
"rows": [{
"uniqueName": "Country"
}, {
"uniqueName": "Destination"
},{
"uniqueName": "Category"
},{
"uniqueName": "Color"
}],
"columns": [{
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "Price"
}],
"expands": {
"expandAll": true
},
},
},
reportcomplete: () => {
flexmonster.off("reportcomplete");
pivot.customizeCell(customizeCellFunction);
}
});
function customizeCellFunction(cell, data) {
if (data && data.type == "header" &&
data.member && data.member.caption != 'All' &&
data.label == "") {
cell.text = data.member.caption;
}
if (data.hierarchy &&
data.member ) {
var parts = cell.text.split(data.escapedLabel);
if (parts.length == 2) {
cell.text = `<div class='notexpandable' onclick="preventExpand(event)"><div class='notexpandable' onclick="preventExpand(event)">${data.escapedLabel}</div>${parts[1]}</div>`;
}
}
}
function preventExpand(e) {
e.stopImmediatePropagation();
}
function clearCustomizing() {
pivot.customizeCell();
}
function startCustomizing() {
// pivot.customizeCell(customizeCellFunction);
}
function clickHandler()...