JSFiddle - React, Tailwind, and code Playground

by Flexmonster Pivot Table

HTML

<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>

JavaScript

let pivot = new Flexmonster({
  container: 'pivot-container',
  toolbar: true,
  componentFolder: 'https://cdn.flexmonster.com/',
  height: 400,
  report: {
    dataSource: {
      type: 'api',
      index: '1948574',
      url: pivotEndpoint,
    },
    slice: {
      rows: [
        {
          uniqueName: 'filename',
        },
      ],
      columns: [
        {
          uniqueName: 'operation',
        },
        {
          uniqueName: '[Measures]',
        },
      ],
      measures: [
        {
          uniqueName: 'id',
          aggregation: 'sum',
          format: '-1i1i64la47eq0',
        },
        {
          uniqueName: 'id',
          aggregation: 'differenceofrow',
          format: '-sr4y5b34n3400',
        },
      ],
    },
    options: {
      grid: {
        showTotals: 'off',
        showGrandTotals: 'off',
        autoSwitchToCompact: false,
      },
      chart: {
        activeMeasure: {
          uniqueName: {},
        },
      },
    },
    formats: [
      {
        name: '-1i1i64la47eq0',
        nullValue: '0',
      },
      {
        name: '-sr4y5b34n3400',
        nullValue: '',
      },
    ]
  },
});

/* ---------- Responses ---------- */

const fieldsResponse = {
  fields: [
    { uniqueName: 'id', type: 'number' },
    { uniqueName: 'operation', type: 'string' },
    { uniqueName: 'filename', type: 'string' },
    { uniqueName: 'tablename', type: 'string' },
    { uniqueName: 'command', type: 'string' },
    { uniqueName: 'who', type: 'string' },
  ],
  aggregations: {
    any: ['count', 'distinctcount'],
    number: ['sum', 'average', 'count', 'distinctcount', 'min', 'max'],
  },
  sorted: false,
};

const membersResponses = {
  filename: {
    members: [
      { id: 'test', value: 'test' },
      { id: 'test 1', value: 'test 1' },
      { id: 'test 2', value: 'test 2' },
    ],
    sorted: true,
    pageTotal: 1,
    page: 0,
   ...