Return to initial report configuration after making changes

Configuring the report

by Flexmonster Pivot Table

HTML

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

<p>
  Add conditional formatting, number formatting, change slice, etc. Then
  click the button below to see the initial configurations.
</p>

<button onclick="restoreInitialConfiguration()">
  Return to initial report configurations
</button>

<div id="pivot-container">The component will appear here</div>

CSS

@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);

JavaScript

let report;

let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {
    dataSource: {
      filename: "data/data.csv"
    },
    slice: {
      rows: [{
        uniqueName: "Destination"
      }],
      columns: [{
          uniqueName: "Category"
        },
        {
          uniqueName: "Color"
        },
        {
          uniqueName: "[Measures]"
        }
      ],
      measures: [{
        uniqueName: "Price"
      }]
    }
  },
  reportcomplete: () => {
    report = pivot.getReport();
    pivot.off("reportcomplete");
  }
});

function restoreInitialConfiguration() {
  pivot.setReport(report);
}