Expand all - phantom record
by ilaria_nunziante
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="expandAll()">Expand all</button>
<button onclick="collapseAll()">Collapse all</button>
<div id="pivot-container"></div>
JavaScript
var data = [
{
"Product": "Prod1-ITA",
"Country": "ITA",
"Quantity": 1.0,
"Month": "2025 - M11",
"ThreeMonth": "2025 - Q04",
"Year": 2025
},
{
"Product": "Prod2-ITA",
"Country": "ITA",
"Quantity": 2,
"Month": "2025 - M11",
"ThreeMonth": "2025 - Q04",
"Year": 2025
},
{
"Product": "Prod1-USA",
"Country": "US",
"Quantity": 3,
"Month": "2025 - M11",
"ThreeMonth": "2025 - Q04",
"Year": 2025
}
];
var pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 430,
report: {
"dataSource": {
"type": "json",
"data": data,
"mapping": {
"Product": {
"type": "string",
"caption": "Product"
},
"Country": {
"type": "string",
"caption": "Country"
},
"Quantity": {
"type": "number",
"caption": "Quantity"
},
"Month": {
"type": "level",
"hierarchy": "Bucket",
"parent": "ThreeMonth",
"caption": "Month"
},
"ThreeMonth": {
"type": "level",
"hierarchy": "Bucket",
"parent": "Year",
"caption": "Three months"
},
"Year": {
"type": "level",
"hierarchy": "Bucket",
"filters": true,
"caption": "Year"
}
}
},
"slice": {
"rows": [
{
"uniqueName": "Country"
},
{
"uniqueName": "Product"
}
],
"columns": [
{
"uniqueName": "Bucket"
},
{
...