Skip to content

Commit

Permalink
Fixes #86: Deselects nodes which are no longer items after items change.
Browse files Browse the repository at this point in the history
  • Loading branch information
bicknellr committed Jan 5, 2016
1 parent 1ce0edd commit 5ecd3eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion iron-multi-selectable.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
if (this.multi) {
this._selectMulti(this.selectedValues);
} else {
this._selectSelected(this.selected);
this._selectSelected();
}
},

Expand Down
14 changes: 6 additions & 8 deletions iron-selectable.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
},

observers: [
'_updateSelected(attrForSelected, selected)'
'_selectSelected(attrForSelected, selected)'
],

created: function() {
Expand All @@ -146,7 +146,7 @@
this._observer = this._observeItems(this);
this._updateItems();
if (!this._shouldUpdateSelection) {
this._updateSelected(this.attrForSelected,this.selected)
this._selectSelected();
}
this._addListener(this.activateEvent);
},
Expand Down Expand Up @@ -221,13 +221,11 @@
var nodes = Polymer.dom(this).queryDistributedElements(this.selectable || '*');
nodes = Array.prototype.filter.call(nodes, this._bindFilterItem);
this._setItems(nodes);
// Deselect anything that is no longer an item.
this._selection.clear(nodes);
},

_updateSelected: function() {
this._selectSelected(this.selected);
},

_selectSelected: function(selected) {
_selectSelected: function() {
this._selection.select(this._valueToItem(this.selected));
},

Expand Down Expand Up @@ -294,7 +292,7 @@
this._updateItems();

if (this._shouldUpdateSelection) {
this._updateSelected();
this._selectSelected();
}
});
},
Expand Down

0 comments on commit 5ecd3eb

Please sign in to comment.