JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
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>
JavaScript
let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
height: 400,
toolbar: true,
beforetoolbarcreated: customizeToolbar,
report: {
dataSource: {
filename: "data/data.json"
}
}
});
function customizeToolbar(toolbar) {
let tabs = toolbar.getTabs();
toolbar.getTabs = function() {
tabs = tabs.map(tab => {
if (tab.id === "fm-tab-charts") {
tab.menu = tab.menu.map(item => {
item.handler = (type) => {
/*
Your custom code to handle chart selection
*/
console.log("Switch to '"+type+"' chart");
//Open chart
pivot.showCharts(type);
}
return item;
});
return tab;
} else return tab;
})
return tabs;
}
}