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-header.fm-filter-header,
.fm-header.fm-header-c,
.fm-header.fm-header-r.fm-empty,
.fm-cols-filter div {
background-color: #4472c4 !important;
color: white !important;
}
JavaScript
var pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
report: {
dataSource: {
dataSourceType: "json",
data: getData()
},
options: {
grid: {
type: "compact"
},
showGrandTotals: false,
showAggregationLabels: false
},
slice: {
rows: [{
uniqueName: "HealthSystemName",
caption: "Health System"
}, {
uniqueName: "FacilityName",
caption: "Facility"
}],
columns: [{
uniqueName: "Type"
}, {
uniqueName: "[Measures]"
}],
measures: [{
uniqueName: "ITDValue",
grandTotalCaption: "ITDValue",
aggregation: "sum"
},
{
uniqueName: "YTDValue",
grandTotalCaption: "YTDValue",
aggregation: "sum"
}, {
uniqueName: "priorMonthValue",
grandTotalCaption: "priorMonthValue",
aggregation: "sum"
},
],
expands: {
expandAll: true
},
},
formats: [{
name: "",
currencySymbol: "$ "
}]
},
toolbar: true,
width: "100%",
height: 600
});
function getData() {
return [{
"HealthSystemName": "Alameda Health System",
"FacilityName": "Alameda Hospital",
"ITDValue": 35733,
"YTDValue": 0,
"priorMonthValue": 0,
"Type": "Savings"
},
{
"HealthSystemName": "Alameda Health System",
"FacilityName": "Highland Hospital",
"ITDValue": 183662,
"YTDValue": 15745,
"priorMonthValue": 3926,
"Type": "Savings"
},
{
"HealthSystemName": "Alameda Health System",
"FacilityName": "San Leandro Hospital",
"ITDValue": 0,
"YTDValue": 0,
"priorMonthValue": 0,
"Type": "Savings"
},
{
"HealthSystemName": "Appalachian",
"FacilityName": "ARH Mary Breckinridge Hospital",
"ITDValue": 4035,
...