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://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>
JavaScript
var pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 430,
toolbar: true,
customizeContextMenu: customizeFlexmonsterContextMenu,
report: {
dataSource: {
filename: "data/data.csv"
},
slice: {
rows: [{
uniqueName: "Color"
}, {
uniqueName: "Country"
}],
columns: [{
uniqueName: "[Measures]"
}],
measures: [{
uniqueName: "Price",
format: "currency"
}],
}
}
});
function customizeFlexmonsterContextMenu(items, data, viewType) {
items.push({
label: "Hi",
submenu: [
{label: "Hallo", handler: function() {alert("Hi from Germany ;-) ")}},
{label: "Hello", handler: function() {alert("Hi from here ;-) ")}},
{label: "Learn more", handler: function() {document.location.href = "https://www.flexmonster.com/api/customizecontextmenu/?hilite=%22context%22%2C%22menu%22";}}
]
});
items.push({
label: "Expand All",
handler: function() {
pivot.expandAllData();
}
});
items.push({
label: "Collapse All",
handler: function() {
pivot.collapseAllData();
}
});
return items;
}