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>
JavaScript
var pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
type: "json",
data: getData(),
mapping: {
"FormName1.Field_1": {
type: "string",
dimensionUniqueName: "FormName1",
dimensionCaption: "Form Name 1"
},
"FormName1.Field_2": {
type: "string",
dimensionUniqueName: "FormName1",
dimensionCaption: "Form Name 1"
},
"FormName2.Field_3": {
type: "string",
dimensionUniqueName: "FormName2",
dimensionCaption: "Form Name 2"
},
"FormName2.Field_4": {
type: "string",
dimensionUniqueName: "FormName2",
dimensionCaption: "Form Name 2"
},
"FormName2.Field_1": {
type: "string",
dimensionUniqueName: "FormName2",
dimensionCaption: "Form Name 2"
},
"Business Type": {
type: "string"
},
"Country": {
type: "string"
},
"Price": {
type: "number"
},
"Quantity": {
type: "number"
},
"Discount": {
type: "number"
},
}
},
"slice": {
"rows": [{
"uniqueName": "FormName1.Field_1"
}],
"columns": [{
"uniqueName": "Business Type"
},
{
"uniqueName": "[Measures]"
}
],
"measures": [{
"uniqueName": "Price",
"aggregation": "sum"
}]
},
"options": {
"configuratorActive": true
},
},
width: "100%",
height: 370
});
function getData() {
return [{
"FormName1.Field_1": "262 oz",
"FormName1.Field_2": "red",
"FormName2.Field_3": "fresh",
"FormName2.Field_4": "USA",
"FormName2.Field_1": "200 oz",
"Business Type": "Specialty Bike Shop",
"Country": "Australia",
...