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>
CSS
.fm-toolbar-group-left #fm-tab-newtab{
width:120px!important;
}
.fm-toolbar-group-left #fm-tab-newtab .fm-svg-icon {
width:36%!important;
margin-left:32%!important;
margin-right:32%!important;
}
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) {
toolbar.showShareReportTab = true;
let tabs = toolbar.getTabs();
let newTabs = [];
toolbar.getTabs = function() {
newTabs.push(tabs.filter(tab => tab.id == 'fm-tab-save')[0])
newTabs.push(tabs.filter(tab => tab.id == 'fm-tab-share')[0])
newTabs.push(tabs.filter(tab => tab.id == 'fm-tab-export')[0])
newTabs.push({
divider: true
})
newTabs.push(tabs.filter(tab => tab.id == 'fm-tab-grid')[0])
newTabs.push(tabs.filter(tab => tab.id == 'fm-tab-charts')[0])
newTabs.push({
divider: true
})
newTabs.push({
id: "fm-tab-newtab",
title: "Drill down to Line",
handler: newtabHandler,
icon: "<img src='http://cdn.onlinewebfonts.com/svg/img_571.png'/>",
})
return newTabs;
}
let newtabHandler = () => {
alert("New tab!");
}
}