diff --git a/paper-datatable.html b/paper-datatable.html index d1c8907..c2b2146 100644 --- a/paper-datatable.html +++ b/paper-datatable.html @@ -525,9 +525,13 @@ }); }, - _setRowKeys: function(){ + _setRowKeys: function(splices){ var rowKeys = []; this._dataKeyCollection = Polymer.Collection.get(this.data); + if (splices) { + // ensure no lingering indices exist that point to removed elements + Polymer.Collection.applySplices(this.data, splices); + } this.data.forEach(function(row){ var key = this._dataKeyCollection.getKey(row); if('filter' in this){ @@ -839,7 +843,21 @@ } } }, - + /** + * Removes all selected elements from the dataset and the view + */ + removeSelectedRows: function () { + var i = 0, key=null; + for (i; i < this.selectedKeys.length; ++i) { + key = this.selectedKeys[i]; + this.splice('selectedKeys', i--, 1); + this._removeRowAtKey(key); + } + }, + _removeRowAtKey: function(key) { + var obj = this._getByKey(key); + this.splice('data', this.data.indexOf(obj), 1); + }, /** * Sort the specified column, where `column` is a reference to the actual `` * element.