Added support for missing "select" callback
authorAlexander Ebert <ebert@woltlab.com>
Tue, 8 Mar 2016 18:25:46 +0000 (19:25 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 8 Mar 2016 18:25:46 +0000 (19:25 +0100)
wcfsetup/install/files/js/WoltLab/WCF/Ui/Search/Input.js

index 464b238ee48f05363faac09763b07e1260b9fb73..642f37e6974f01decd4caaa9514714b8e484d28b 100644 (file)
@@ -216,7 +216,12 @@ define(['Ajax', 'Core', 'EventKey', 'Dom/Util', 'Ui/SimpleDropdown'], function(A
                 * @protected
                 */
                _selectItem: function(item) {
-                       this._element.value = elData(item, 'label');
+                       if (this._options.callbackSelect && this._options.callbackSelect(item) === false) {
+                               this._element.value = '';
+                       }
+                       else {
+                               this._element.value = elData(item, 'label');
+                       }
                        
                        this._activeItem = null;
                        UiSimpleDropdown.close(this._dropdownContainerId);