JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>
JavaScript
const pivot = new Flexmonster({
container: 'pivot-container',
componentFolder: 'https://cdn.flexmonster.com/',
toolbar: true,
report: {
dataSource: {
data: getData(),
mapping: {
IdString: {
type: 'string',
},
},
},
options: {
grid: {
type: 'flat',
},
},
},
})
function getData() {
return [
{
IdString: '001234',
IdNumber: '001234',
Country: 'Canada',
State: 'Ontario',
City: 'Toronto',
Price: 174,
Quantity: 22,
},
{
IdString: '001235',
IdNumber: '001235',
Country: 'USA',
State: 'California',
City: 'Los Angeles',
Price: 166,
Quantity: 19,
},
{
IdString: '001236',
IdNumber: '001236',
Country: 'USA',
State: 'Florida',
City: 'Tallahassee',
Price: 215,
Quantity: 25,
},
{
IdString: '001237',
IdNumber: '001237',
Country: 'Canada',
State: 'Quebec',
City: 'Montreal',
Price: 194,
Quantity: 15,
},
]
}