Adding a new tab with a dropdown menu
Customizing the Toolbar
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<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,
beforetoolbarcreated: customizeToolbar,
report: {
dataSource: {
filename: "data/data.json"
}
}
});
function customizeToolbar(toolbar) {
toolbar.getTabs = function() {
let tabs = [];
tabs.unshift({
id: "fm-tab-newtab",
title: "New Tab",
menu: [{
id: "fm-tab-one",
title: "Tab one",
handler: handlerOne
},
{
id: "fm-tab-two",
title: "Tab two",
handler: handlerTwo
},
{
id: "fm-tab-three",
title: "Tab three",
handler: handlerThree
}
],
icon: this.icons.open
});
return tabs;
}
let handlerOne = () => {
alert("Handler one");
}
let handlerTwo = () => {
alert("Handler two");
}
let handlerThree = () => {
alert("Handler three");
}
}