Error on update data

by ilaria_nunziante

HTML

<link rel="stylesheet" href="https://cdn.flexmonster.com/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button id="btn" onclick="editRecords()">Update data</button>
<input type="checkbox" id="cb" onclick="turnOff(event)"/> 
<span>Turn off CustomizeCell</span>
<div id="pivot-container"></div>

JavaScript

var pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  height: 430,
  customizeCell: customizeCellFunction,
  report: {
    dataSource: {
      data: getData()
    },
    slice: {
      rows: [{
          "uniqueName": "[Measures]"
        },
        {
          "uniqueName": "Country"
        },
        {
          "uniqueName": "Category"
        },

      ],
      columns: [],
      measures: [{
          "uniqueName": "Price"
        },
        {
          "uniqueName": "Sale"
        }
      ]
    }
  }
});



function editRecords() {
  var dataForUpdate = [{
    "Category": "Accessories",
    "Country": "Italy",
    "Price": 0,
    "Sale": 400,
    "RowId": 1
  }]
  flexmonster.updateData({
    data: dataForUpdate
  }, {
    partial: true
  });
}
var turnedOff = false;

function customizeCellFunction(cell, data) {
  console.log('turnedoff: ' + turnedOff);
  if (!turnedOff) {
    var report = pivot.getReport();
  }
}

function turnOff() {
  turnedOff = !turnedOff;
}

function getData() {
  return [{
      "Category": {
        "type": "string"
      },
      "Country": {
        "type": "string"
      },
      "Price": {
        "type": "number"
      },
      "Sale": {
        "type": "number"
      },
      "RowId": {
        "type": "id"
      },
      "DeleteRow": {
        "type": "delete"
      }
    },
    {
      "Category": "Accessories",
      "Country": "Italy",
      "Price": 242,
      "Sale": 400,
      "RowId": 1
    },
    {
      "Category": "Bikes",
      "Country": "Italy",
      "Price": 1487,
      "Sale": 400,
      "RowId": 2
    },
    {
      "Category": "Clothing",
      "Country": "Italy",
      "Price": 40,
      "Sale": 400,
      "RowId": 3
    }
  ]
}