Customizing the Toolbar prototype

Customizing the Toolbar

by Flexmonster Pivot Table

HTML

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

<div id="pivot-container"></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/",
  toolbar: true,
  beforetoolbarcreated: customizeToolbar
});

function customizeToolbar(toolbar) {
  FlexmonsterToolbar.prototype.getTabs = function() {
    var tabs = [];
    tabs.push({
      id: "fm-tab-connect",
      title: this.Labels.connect,
      handler: () => {
        this.pivot.connectTo({
          filename: "https://cdn.flexmonster.com/data/data.csv"
        });
      },
      icon: this.icons.connect
    });
    return tabs;
  }
}