API call save - withGlobals and withDefaults

Configuring the report

by Flexmonster Pivot Table

HTML

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

<button onclick="saveReport()">Save report</button>
<button onclick="saveReportDefaults()">Save report with defaults</button>
<button onclick="saveReportGlobals()">Save report with globals</button>
<button onclick="saveReportGlobalsDefaults()">Save report with globals and defaults</button>

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

CSS

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

JavaScript

const pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  global: {
    localization: "loc/es.json",
    options: {
      grid: {
        showHeaders: true,
      },
      defaultHierarchySortName: "desc",
      readOnly: true,
    },
  },
  report: {
    dataSource: {
      type: "csv",
      filename: "data/data-fr.csv",
    },
    options: {
      grid: {
        showGrandTotals: "rows",
      },
      readOnly: false,
    },
    localization: "loc/fr.json",
  },
});

function saveReport() {
  pivot.save();
}

function saveReportGlobals() {
  pivot.save({
    withGlobals: true,
  });
}

function saveReportDefaults() {
  pivot.save({
    withDefaults: true,
  });
}

function saveReportGlobalsDefaults() {
  pivot.save({
    withGlobals: true,
    withDefaults: true,
  });
}