Change a slice for the flat form in runtime

Slice configuration

by Flexmonster Pivot Table

HTML

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

<button onclick="runQuery()">Change the slice</button>

<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,
  report: {
    dataSource: {
      filename: "data/data.csv"
    },
    options: {
      grid: {
        type: "flat"
      }
    }
  }
});

function runQuery() {
  let slice = {
    columns: [
      { uniqueName: "Country" },
      { uniqueName: "Color" },
      { uniqueName: "Price" }
    ],
  };

  pivot.runQuery(slice);
}