API calls getCell, getSelectedCell, and removeSelection

Other

by Flexmonster Pivot Table

HTML

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

<p>
  In this example, you can get info about a cell on the specific position or
  about the currently selected cell. The info will appear under the component.
</p>

<button onclick="getCell()">Get cell 1:1</button>
<button onclick="getSelectedCell()">Get selected cell</button>
<button onclick="removeSelection()">Remove selection</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: 260,
  report: {
    dataSource: {
      filename: "data/data.csv"
    }
  }
});

function getCell() {
  let cell = pivot.getCell(1, 1);
  showOutput(JSON.stringify(cell, null, 4));
}

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

function removeSelection() {
  pivot.removeSelection();
}

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