JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<link rel="stylesheet" type="text/css" href="https://cdn.flexmonster.com/theme/orange/flexmonster.min.css" />
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="switchToCompact()">Switch to Compact</button>
<button onclick="switchToClassic()">Switch to Classic</button>
<div id="pivot-container"></div>
JavaScript
var pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
type: "csv",
filename: "data/data.csv"
},
options: {
grid: {
type: "classic"
}
},
slice: {
rows: [{
uniqueName: "Country"
}, {
uniqueName: "Business Type"
}],
columns: [{
uniqueName: "Color"
}, {
uniqueName: "[Measures]"
}],
measures: [{
uniqueName: "Price"
}],
}
},
width: "100%",
height: 500
});
function switchToCompact() {
pivot.setOptions({
"grid": {
"type": "compact"
}
});
pivot.refresh();
}
function switchToClassic() {
pivot.setOptions({
"grid": {
"type": "classic"
}
});
pivot.refresh();
}