datachanged

Events

by soso

HTML

<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>


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

JavaScript

var pivot = new Flexmonster({
	container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {
    dataSource: {
    	data: getData()
    },
    options: {
    	editing: true
    }
  }
});

/* flexmonster.on('datachanged', function (e) {
  const { field, id, value, oldValue } = e.data[0];

  logReportData();
  const dataForUpdate = {
    "RowId": id,
    [field]: value,
  }
  //flexmonster.updateData({ data: dataForUpdate }, { partial: true });
}); */

flexmonster.on('drillthroughclose', function() {
  console.log('onDrillThroughClose:');
  logReportData();
});

function logReportData() {
  const reportData = flexmonster.getReport().dataSource.data;
  console.log(reportData);
}


function getData() {
  return [{
  	"Color": {type: "string"},
    "RowId": {type: "id"},
    "Price": {type: "number"},
    "Shape": {type: "string" },
  },
  {
    "Color": "green",
    "RowId": 1,
    "Price": 174,
    "Shape": "Square"
    
  }, {
    "Color": "red",
    "RowId": 2,
    "Price": 30,
    "Shape": "Circle"
  }];
}