PolymerElements / iron-selector

Manages a list of elements that can be selected
32 stars 55 forks source link

In multi mode, already selected items fire deselect and then select when selection change occurs #75

Closed reinert closed 8 years ago

reinert commented 8 years ago

The problem is due to the selectMulti logic:

_selectMulti: function(values) {
  this._selection.clear();
  if (values) {
    for (var i = 0; i < values.length; i++) {
      this._selection.setItemSelected(this._valueToItem(values[i]), true);
    }
  }
}

It first clear all selection, to reselect only the current selected values. The collateral effect is that if an item was already selected, it will fire a deselect event, and then fire a select event again (even though it was already selected)