wenzhixin/multiple-select

filterAcceptOnEnter and single

Closed this issue · 0 comments

Hi

When trying to filterAcceptOnEnter with single : true there is no selection return
I have changed the code to include the single selection with version 1.3.1
Thanks

        }).off('keyup').on('keyup', function (e) {
          // enter or space
          // Avoid selecting/deselecting if no choices made
          if (_this4.options.filterAcceptOnEnter && [13, 32].includes(e.which) && _this4.$searchInput.val()) {
            if (_this4.options.single) {
							var $items = _this4.$selectItems.filter(':visible');
							var $val = Array(_this4.$selectItems.filter(':visible').val());
							if ($items.length == 1) {
								_this4.updateSelectAll();
								_this4.setSelects($val);
							}
						} else {
							_this4.$selectAll.click();
						}

            _this4.close();

            _this4.focus();

            return;
          }