JSFiddle - React, Tailwind, and code Playground

by juvian

HTML

<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/",
  width: "100%",
  height: 500,
  toolbar: true,
  report: {
    dataSource: {
      type: "api",
      url: "https://olap.flexmonster.com:9500",
      index: "fm-product-sales"
    },
    slice: {
      expands: {
        //Remove this option to check expand requests made in runtime
        expandAll: true
      },
      rows: [{
          uniqueName: "Color"
        }, {
          uniqueName: "Destination"
        },
        {
          uniqueName: "[Measures]"
        }
      ],
      columns: [{
          uniqueName: "Country"
        },
        {
          uniqueName: "Category"
        }
      ],
      measures: [{
        uniqueName: "Price"
      }]
    }
  }
});

const cols = [];
const rows = ['Color'];

for (let i = 0; i <= rows.length; i++) {
  for (let j = 0; j <= cols.length; j++) {
     console.log(rows.slice(0, i).concat(cols.slice(0, j)));
  }
}