Filterclose fires on updateData/refresh

Click on buttons without opening the fillter popup: filterclose event is not called. If you open the popup, then filterclose is called at every UpdateData/Refresh

by ilaria_nunziante

HTML

<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<button id="updBtn">Update data</button>
<button id="rfsBtn">Refresh</button>
<div id="pivot-container"></div>

JavaScript

var popupOpenedMsg = 'Popup opend at least once. Refresh the browser page to reset.';
var popupNotOpenedMsg = 'Popup never opened';
var firstTimeOpeningMsg = 'First time opening popup';
var popupOpened = false;

$('#updBtn').click(
  function() {
    alert('Updating: ' + (popupOpened ? popupOpenedMsg : popupNotOpenedMsg));
    flexmonster.updateData({
      data: [{
        "Color": "green",
        "Price": 300,
        "RowId": 1
      }]
    }, {
      partial: true
    })
  });

$('#rfsBtn').click(
  function() {
    alert('Refreshing: ' + (popupOpened ? popupOpenedMsg : popupNotOpenedMsg));
    flexmonster.refresh();
  });


var pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  width: "100%",
  height: 430,
  toolbar: true,
  report: {
    dataSource: {
      data: getData()
    },
    slice: {
      rows: [{
        uniqueName: "Color"
      }],
      measures: [{
        uniqueName: "Price"
      }],
    }
  }
});

flexmonster.on('filterclose', function() {
  alert('filterClose');
});

flexmonster.on('filteropen', function() {
  if (!popupOpened) {
    popupOpened = true;
    alert(firstTimeOpeningMsg);
  } else {
    alert(popupOpenedMsg);
  }
});

function getData() {
  return [{
    "Color": {
      "type": "string"
    },
    "Price": {
      "type": "number"
    },
    "RowId": {
      "type": "id"
    },
  }, {
    "Color": "green",
    "Price": 174,
    "RowId": 1
  }, {
    "Color": "red",
    "Price": 1664,
    "RowId": 2
  }, {
    "Color": "white",
    "Price": 7941,
    "RowId": 3
  }, {
    "Color": "yellow",
    "Price": 6650,
    "RowId": 4
  }, {
    "Color": "blue",
    "Price": 865,
    "RowId": 5
  }, {
    "Color": "purple",
    "Price": 511,
    "RowId": 6
  }];
}