olap events

Events

by Flexmonster Pivot Table

HTML

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

<div>
  <p>
    Click the <b>Load data</b> button to trigger the
    <code>loadingolapstructure</code> event.
  </p>
  <p>
    After successfully loading the data, the
    <code>olapstructureloaded</code> event is triggered and outputs the message
    under the component.
  </p>
  <p>
    If there are any issues when loading the data, the
    <code>olapstructureerror</code> event is triggered and outputs the error
    message under the component.
  </p>
</div>

<button onclick="updateData()">Load data</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

var pivot = new Flexmonster({
	container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  height: 290
});

let outputInitialized = false;

function showOutput(content) {
  var log = "[" + (new Date()).toLocaleTimeString('en-US') + "] " + content;
  var outputElement = document.getElementById("output");
  if (!outputInitialized) {
    outputElement.innerText = '';
    outputInitialized = true;
  }
  outputElement.innerText += log + "\n";
  outputElement.scrollTop = outputElement.scrollHeight;
}

pivot.on('loadingolapstructure', function () {
  showOutput('Loading olap structure!');
});
pivot.on('olapstructureloaded', function () {
  showOutput('Olap structure loaded!');
});
pivot.on('olapstructureerror', function (e) {
  showOutput('Error with olap structure! ' + e.error);
});

function updateData() {
  pivot.connectTo({
    type: 'microsoft analysis services',
    proxyUrl: 'https://olap.flexmonster.com/olap/msmdpump.dll',
    dataSourceInfo: 'Provider=MSOLAP; Data Source=extranet;', 
    catalog: 'Adventure Works DW Standard Edition', 
    cube: 'Adventure Works'
  })
}