Filter bug

by ilaria_nunziante

HTML

<link rel="stylesheet" href="https://cdn.flexmonster.com/2.3/demo.css">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<input type="checkbox" id="cb_showEmptyValue" onchange="showEmptyValueChanged()" checked/>Show empty values
<input type="checkbox" id="cb_idField" onchange="idFieldChanged()" checked/>Add id field
<input type="checkbox" id="cb_filter" onchange="filterChanged()"/> Filtered
<div id="pivot-container"></div>

JavaScript

function getReport(showEmptyValues, idField) {
  var showEmptyValues = $("#cb_showEmptyValue").is(':checked');
  var idField = $("#cb_idField").is(':checked');
  var report = {
    "dataSource": {
      "data": [{
          "Category": "Accessories",
          "ID_Accessories": 1,
          "Color": "green",
          "ID_Color": 1,
          "Country": "Australia",
          "ID_Country": 1,
          "Price": 680,
          "RowId": "1"
        },
        {
          "Category": "Bikes",
          "ID_Accessories": 2,
          "Color": "green",
          "ID_Color": 1,
          "Country": "Germany",
          "ID_Country": 2,
          "Price": 1487,
          "RowId": "2"
        },
        {
          "Category": "Bikes",
          "ID_Accessories": 2,
          "Color": "blue",
          "ID_Color": 2,
          "Country": "Australia",
          "ID_Country": 1,
          "Price": 9245,
          "RowId": "3"
        }
      ],
      "mapping": {
        "Color": {
          "type": "string"
        },
        "Country": {
          "type": "string"
        },
        "Category": {
          "type": "string"
        },
        "Price": {
          "type": "number"
        },
        "ID_Accessories": {
          "type": "property",
          "hierarchy": "Category"
        },
        "ID_Color": {
          "type": "property",
          "hierarchy": "Color"
        },
        "ID_Country": {
          "type": "property",
          "hierarchy": "Country"
        }
      }
    },
    "options": {
      "showEmptyValues": showEmptyValues
    },
    "slice": {
      "rows": [{
          "uniqueName": "Category"
        },
        {
          "uniqueName": "Country"
        }
      ],
      "columns": [{
          "uniqueName": "Color"
        },
        {
          "uniqueName": "[Measures]"
        }
      ],
      "measures": [{
        "uniqueName": "Price",
        "aggregation": "sum"
      }]
    }
  }
  if (idField) {
   ...