JSFiddle - React, Tailwind, and code Playground

Number formatting

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",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  customizeCell: customizeCellFunction,
  toolbar: true,
  report: {
    dataSource: {
      data: getData(),
    },
    formats: [
      {
        name: "",
        decimalPlaces: 0,
      },
    ],
  },
})

function customizeCellFunction(cell, data) {
  if (data.type == "value") {
    cell.text = Math.round(data.value)
  }
}

function getData() {
  return [
    {
      Field: "A",
      Value: 123.456789,
    },
    {
      Field: "B",
      Value: 1234.56789,
    },
    {
      Field: "C",
      Value: 12345.6789,
    },
  ]
}