Customize toolbar with beforetoolbarcreated event

Events

by Ravi A

HTML

<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>


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

JavaScript

var pivot = new Flexmonster({
	container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true
  /* beforetoolbarcreated: customizeToolbar */
});

function customizeToolbar(toolbar) {
  // override tabs
  toolbar.getTabs = function() {
    var tabs = [];
    tabs.push({
      id: "fm-tab-connect",
      icon: this.icons.connect,
      handler: function() {
        this.pivot.connectTo({
          dataSourceType: "csv",
          filename: "data/data.csv"
        });
      }
    });
    return tabs;
  }
}