Bug Update/Delete 1 Rec (OK)

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="addRecord()">Add</button>
<button id="btn" onclick="deleteRecord()">Delete</button>
<div id="pivot-container"></div>

JavaScript

var pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  height: 430,
  report: {
    "dataSource": {
      "type": "json",
      "data": [{
        "Product": "Product 0",
        "Orders": 52,
        "RowId": "0",
      }, ],
      "mapping": {
        "Product": {
          "type": "string"
        },
        "Orders": {
          "type": "number"
        },
        "DeleteRow": {
          "type": "delete"
        },
        "RowId": {
          "type": "id"
        }
      }
    },
    "slice": {
      "rows": [{
        "uniqueName": "Product",
      }],
      "columns": [{
        "uniqueName": "[Measures]"
      }],
      "measures": [{
          "uniqueName": "Sales"
        },
        {
          "uniqueName": "Orders"
        }
      ],
      "expands": {
        "expandAll": true
      },
      "drills": {
        "drillAll": true
      }
    }
  }
});

function update(data) {
  flexmonster.updateData({
    data: data
  }, {
    partial: true
  });
}


function addRecord() {
  this.update([{
    "Product": "Product 1",
    "Orders": 100,
    "RowId": "1",
  }]);
}

function deleteRecord() {
  this.update([{
    "Product": "Product 1",
    "RowId": "1",
    "DeleteRow": true,
  }]);
}