JSFiddle - React, Tailwind, and code Playground

by Flexmonster Pivot Table

HTML

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

<p>
  Please choose the <code>sample_immat.csv</code> file that you have sent us to see the result.
</p>

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

CSS

p {
  font-size: 15px;
  line-height: 1.5;
  padding-right: 10px;
  padding-left: 10px;
}

code {
    font-size: 105%;
    color: #DF3800;
    background-color: #f5f5f5;
    padding: 1px 4px;
    font-family: monospace !important;
    border-radius: 4px;
}

JavaScript

let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  beforetoolbarcreated: customizeToolbar,
  toolbar: true,
  report: {
    // Set mapping inside the data source
    dataSource: {
      type: "csv",
      browseForFile: true,
      mapping: {
        MODELE_ETUDE: {
          type: "string"
        }
      }
    }
  }
});

// Modify the "Connect" tab to include mapping
function customizeToolbar(toolbar) {
  // Get all tabs 
  var tabs = toolbar.getTabs();
  toolbar.getTabs = function() {
    // Modify tab
    tabs = tabs.map(tab => {
      if (tab.id === "fm-tab-connect") {
        tab.menu[0].handler = connectToCsvHandler;
      }
      return tab;
    });
    return tabs;
  }
  let connectToCsvHandler = function() {
    pivot.connectTo({
      type: "csv",
      browseForFile: true,
      mapping: {
        MODELE_ETUDE: {
          type: "string"
        }
      }
    })
  }
}