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>

<button onclick="allowAutoCellExpand()">
Show full description
</button>
<button onclick="setDefaultTableSize()">
Hide full description
</button>

<div id="pivotContainer"></div>

JavaScript

let pivot = new Flexmonster({
  container: "pivotContainer",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {
    dataSource: {
      data: getData()
    },
    "slice": {
      "rows": [{
          "uniqueName": "Item"
        },
        {
          "uniqueName": "Description"
        }
      ],
      "columns": [{
        "uniqueName": "[Measures]"
      }],
      "measures": [{
        "uniqueName": "Price",
        "aggregation": "sum"
      }],
      "expands": {
        "rows": [{
          "tuple": [
            "item.[car]",
          ]
        },{
          "tuple": [
            "item.[bike]",
          ]
        }]
      }
    }
  }
});

function tableSizes(){
  return {
    rows: [{
    tuple : ["item.[bike]"],
    height : 50
    }]
  }
}

let multilineCssRule = ".fm-cell { white-space: pre-wrap !important; }";

function allowAutoCellExpand() {
   flexmonster.setTableSizes({});
}

function setDefaultTableSize() {
 flexmonster.setTableSizes({
         columns: [
            {
                idx: 0,
                width: 120
            }
        ] 
    });

}



function getData() {
  return [{
      Item: "Car",
      Price: 20000,
      Description: "Black cabrio with 500hp engine, available with manual and authomatic gearbox."
    },
    {
      Item: "Bike",
      Price: 1000,
      Description: "Professional mountain bike."
    }
  ];
}