Emit select null on selected item removal

Issues:

* Selected item is removed, but no select even was emitted

Changes:

ve.ui.SelectWidget.js
* On remove, emit select null when removing a selected item
* On clear, emit select null always

Change-Id: I1a94b0f8a841611b20e09f6c02f37fb9589e85c3
This commit is contained in:
Trevor Parscal 2013-07-01 16:19:51 -07:00
parent 4fb94d9586
commit cdc342362c

View file

@ -377,6 +377,9 @@ ve.ui.SelectWidget.prototype.removeItems = function ( items ) {
// Remove existing item // Remove existing item
delete this.hashes[hash]; delete this.hashes[hash];
} }
if ( item.isSelected() ) {
this.selectItem( null );
}
} }
ve.ui.GroupElement.prototype.removeItems.call( this, items ); ve.ui.GroupElement.prototype.removeItems.call( this, items );
@ -399,6 +402,7 @@ ve.ui.SelectWidget.prototype.clearItems = function () {
// Clear all items // Clear all items
this.hashes = {}; this.hashes = {};
ve.ui.GroupElement.prototype.clearItems.call( this ); ve.ui.GroupElement.prototype.clearItems.call( this );
this.selectItem( null );
this.emit( 'remove', items ); this.emit( 'remove', items );