JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
HTML
<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/",
toolbar: true,
report: {
dataSource: {
data: getData(),
mapping: {
Agent: {
type: "string"
},
State: {
type: "string"
},
Airline: {
type: "string"
},
"2020 Sales TTV": {
type: "number"
},
"2019 Sales TTV": {
type: "number"
},
Description: {
type: "string"
},
"Description Text": {
type: "property",
hierarchy: "Airline"
}
}
},
"slice": {
"rows": [{
"uniqueName": "Agent"
},
{
"uniqueName": "State"
},
{
"uniqueName": "Airline"
}
],
"columns": [{
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "2020 Sales TTV",
"aggregation": "sum"
},
{
"uniqueName": "2019 Sales TTV",
"aggregation": "sum"
},
{
"uniqueName": "Description",
"aggregation": "sum",
"format": 'left'
}
],
"expands": {
"rows": [{
"tuple": [
"agent.[agent a]"
]
},
{
"tuple": [
"agent.[agent a]",
"state.[vic]"
]
},
{
"tuple": [
"agent.[agent b]",
"state.[mdg]"
]
},
{
"tuple": [
"agent.[agent b]",
"state.[vic]"
]
},
{
"tuple": [
"agent.[agent a]",
"state.[mdg]"
]
}
]
}
},
"options": {
"grid": {
"type": "classic",
"showTotals": "off",
"showGrandTotals":...