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-custom-cell {
display: flex !important;
align-items: center !important;
font-size: 12px !important;
}
.fm-custom-cell .flag-icon {
width: 21px !important;
height: 16px !important;
margin-left: 0 !important;
margin-right: 2px !important;
}
#fm-pivot-view .fm-grid-layout .fm-custom-cell.fm-expanded .fm-expanded-icon::before,
#fm-pivot-view .fm-grid-layout .fm-custom-cell.fm-collapsed .fm-collapsed-icon::before {
top: -2px;
height: 16px;
}
JavaScript
new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 550,
toolbar: true,
report: {
"dataSource": {
"type": "json",
"data": getData(),
"mapping": {
"id": {
"type": "id"
},
"FinancialYear": {
"type": "year",
"hierarchy": "timeperiod"
},
"Month": {
"type": "string"
},
"ProductName": {
"type": "string",
"caption": "Product"
},
"MarketerName": {
"type": "string"
},
"ProductCategoryName": {
"type": "string",
"caption": "Product Category"
},
"LocationName": {
"type": "string",
"caption": "Terminal"
},
"CustomerName": {
"type": "string",
"caption": "Customer"
},
"Jan": {
"type": "number"
},
"Feb": {
"type": "number"
},
"Mar": {
"type": "number"
},
"Apr": {
"type": "number"
},
"May": {
"type": "number"
},
"Jun": {
"type": "number"
},
"Jul": {
"type": "number"
},
"Aug": {
"type": "number"
},
"Sep": {
"type": "number"
},
"Oct": {
"type": "number"
},
"Nov": {
"type": "number"
},
"Dec": {
"type": "number"
},
"Value": {
"type": "number"
}
}
},
"slice": {
"rows": [{
"uniqueName": "LocationName"
},
{
"uniqueName": "CustomerName"
},
{
"uniqueName": "ProductCategoryName"
},
{
"uniqueName": "ProductName"
}
],
"columns": [{
"uniqueName": "timeperiod"
},
...