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
let pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 550,
toolbar: true,
report: {
options: {
//defaultHierarchySortName: 'unsorted',
},
dataSource: {
type: "api",
url: "https://olap.flexmonster.com:9500",
index: "fm-product-sales",
mapping: {
"Category": {
type: "string",
hierarchy: "Item"
},
"Color": {
type: "string",
hierarchy: "Item",
parent: "Category"
},
"Destination": {
type: "string",
hierarchy: "Destination Type"
},
"Business Type": {
type: "string",
hierarchy: "Destination Type",
parent: "Destination"
},
"Country": {
type: "string",
hierarchy: "Destination Type",
parent: "Business Type"
},
"Quantity": {
type: "number",
hierarchy: "Destination Type",
parent: "Country"
},
}
},
slice: {
"reportFilters": [{
"uniqueName": "Discount",
"filter": {
"query": {
"greater_equal": 10
}
}
}],
"rows": [{
"uniqueName": "Destination Type",
"filter": {
"members": [
"destination type.[australia].[specialty bike shop].[australia]"
]
}
}],
"columns": [{
"uniqueName": "Item",
"levelName": "Color"
},
{
"uniqueName": "[Measures]"
},
],
"measures": [{
"uniqueName": "Price",
"aggregation": "sum"
},
{
"uniqueName": "Size",
"aggregation": "count"
}
],
expands: {
expandAll: true,
},
drills: {
drillAll: true,
},
}
}
});