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
let pivot = new Flexmonster({
container: 'pivot-container',
componentFolder: 'https://cdn.flexmonster.com/',
toolbar: true,
report: {
dataSource: {
type: 'json',
data: getData(),
},
slice: {
rows: [
{
uniqueName: 'Category',
},
{
uniqueName: 'Color',
},
],
columns: [
{
uniqueName: '[Measures]',
},
],
measures: [
{
uniqueName: 'Price',
aggregation: 'sum',
},
],
expands: {
rows: [
{
tuple: ['category.[test]'],
},
],
},
},
options: {
grid: {
type: 'classic',
},
},
localization: {
grid: {
blankMember: ' ',
},
},
},
})
function getData() {
return [
{
Category: 'test',
Color: null,
Price: 20,
},
{
Category: 'test',
Color: null,
Price: 22,
},
]
}