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/",
customizeCell: customizeCellFunction,
toolbar: true,
report: {
dataSource: {
dataSourceType: "json",
data: getData()
},
"slice": {
"rows": [
{
"uniqueName": "Person"
}
],
"columns": [
{
"uniqueName": "[Measures]"
}
],
"measures": [
{
"uniqueName": "Transport Charges",
"aggregation": "sum"
},
{
"uniqueName": "On Date",
"aggregation": "max"
}
]
},
options: {
grid: {
showGrandTotals: "off"
},
showAggregationLabels: false
}
},
width: "100%"
});
function customizeCellFunction(cell, data) {
if (data.recordId && data.measure.uniqueName == "On Date") {
if (data.recordId.length > 1)
cell.text = "";
}
}
function getData() {
return [
{
"Person":{"type":"string"},
"Visited Place":{"type":"string"},
"On Date":{"type":"date string"},
"Transport Charges":{"type":"number"},
"Id":{"type":"id"},
},
{
"Person":"Bob",
"Visited Place": "London",
"On Date": "5/1/2010",
"Transport Charges": 10.05,
"Id": 1
},
{
"Person":"Bob",
"Visited Place": "London",
"On Date": "5/1/2010",
"Transport Charges": 5.05,
"Id": 2
},
{
"Person":"Steve",
"Visited Place": "London",
"On Date": "6/4/1982",
"Transport Charges": 10,
"Id": 3
}
];
}