API calls getCell, getSelectedCell, and removeSelection
Other
by Dongor7
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="getCell()">Get cell 1:1</button>
<button onclick="getSelectedCell()">Get selected cell</button>
<div id="pivot-container"></div>
<div class="output" id="output">Output will appear here</div>
CSS
.output {
width: 80%;
height: 300px;
margin-left: auto;
margin-right: auto;
padding: 20px;
background: rgba(242, 242, 242, 1);
font-family: Menlo, Monaco, "Courier New", Courier, monospace;
white-space: pre;
font-size: 16px;
font-weight: 400;
overflow-y: scroll;
margin-top: 20px;
}
JavaScript
let pivot = new Flexmonster({
container: "pivot-container",
height: 300,
componentFolder: "https://cdn.flexmonster.com/",
report: {
dataSource: {
filename: "data/data.csv"
}
}
});
flexmonster.on('drillthroughopen', function (cell) {
console.log('drillthroughopen')
console.log(cell)
showOutput(JSON.stringify(cell.rowData, null, 4));
});
flexmonster.on('celldoubleclick', function (cell) {
console.log('celldoubleclick')
console.log(cell)
});
function getCell() {
let cell = flexmonster.getCell(1, 1);
showOutput(JSON.stringify(cell, null, 4));
}
function getSelectedCell() {
let cell = flexmonster.getSelectedCell();
showOutput(JSON.stringify(cell, null, 4));
}
function showOutput(content) {
document.getElementById("output").innerText = content;
}