Get report from the component using getReport API call

Configuring the report

by Flexmonster Pivot Table

HTML

<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<p>
  Click the <b>Get Report</b> button to output the current report under the
  component.
</p>

<button onclick="getReport()">Get Report</button>

<div id="pivot-container"></div>

<div class="output" id="output">Output will appear here</div>

CSS

@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);

JavaScript

let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  height: 350,
  report: {
    dataSource: {
      filename: "data/data.json"
    }
  }
});

function getReport() {
  let report = pivot.getReport();
  showOutput(JSON.stringify(report, null, 4));
}

function showOutput(content) {
  document.getElementById("output").innerText = content;
}