API calls getMeasuresAsync and getAllMeasuresAsync

Slice configuration

by Flexmonster Pivot Table

HTML

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

<div>
  <p>
    Click the <b>Get Measures</b> button to get selected measures in the report
    using the
    <a href="https://www.flexmonster.com/api/getmeasuresasync/" target="_blank"
    >getMeasuresAsync</a> method. Click the <b>Get All Measures</b> button 
    to get all available measures using the
    <a href="https://www.flexmonster.com/api/getallmeasuresasync/" target="_blank"
    > getAllMeasuresAsync</a> method.
  </p>
  <p>The list of the measures will appear under the component.</p>
</div>

<button onclick="getMeasures()">Get Measures</button>
<button onclick="getAllMeasures()">Get All Measures</button>

<div id="pivot-container">The component will appear here</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: 260,
  report: {
    dataSource: {
      filename: "data/data.csv"
    }
  }
});

function getMeasures() {
  pivot.getMeasuresAsync().then(measures => {
  	showOutput(JSON.stringify(measures, null, 2));
 	}).catch(err => {
  	console.log(err);
  });
}

function getAllMeasures() {
  pivot.getAllMeasuresAsync().then(measures => {
  	showOutput(JSON.stringify(measures, null, 2));
  }).catch(err => {
  	console.log(err);
  });
}

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