JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
July 29, 2020
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<h2>Expand "A" and "B" folders in order to see "C" and "D" lists</h2>
<div id="pivotContainer"></div>
JavaScript
var pivot = new Flexmonster({
container: "pivotContainer",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
data: getData(),
mapping: {
'Country, "C" list': {
dimensionUniqueName: "A",
type: "string"
},
'Size, "C" list': {
dimensionUniqueName: "A",
type: "string"
},
'Color, "D" list': {
dimensionUniqueName: "B",
type: "string"
},
'Item, "D" list': {
dimensionUniqueName: "B",
type: "string"
},
Price: {
type: "number"
}
}
},
options: {
configuratorActive: true
}
}
});
function getData() {
return [{
'Country, "C" list': "Korea",
'Size, "C" list': "41 EU",
'Color, "D" list': "Black",
'Item, "D" list': "Cloth",
"Price": 325
},
{
'Country, "C" list': "USA",
'Size, "C" list': "39 US",
'Color, "D" list': "Green",
'Item, "D" list': "Cloth",
"Price": 124
},
{
'Country, "C" list': "Canada",
'Size, "C" list': "43 US",
'Color, "D" list': "White",
'Item, "D" list': "Vehicle",
"Price": 34656
}
]
}