From ecccaf50a3c88b803252f076af11f8f12b6a349f Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 6 Jul 2015 16:49:38 -0400 Subject: [PATCH] Dropdown will now show when only messsage in menu. Fixed maxSelections from hiding dropdown after selection. #2523 --- src/definitions/modules/dropdown.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index fd887623e..9790db948 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -2544,6 +2544,9 @@ $.fn.dropdown = function(parameters) { input: function() { return ($input.length > 0); }, + items: function() { + return ($item.length > 0); + }, menu: function() { return ($menu.length > 0); }, @@ -2589,6 +2592,9 @@ $.fn.dropdown = function(parameters) { : $menu.transition && $menu.transition('is animating') ; }, + disabled: function() { + $module.hasClass(className.disabled); + }, focused: function() { return (document.activeElement === $module[0]); }, @@ -2700,7 +2706,7 @@ $.fn.dropdown = function(parameters) { return (hasTouch || settings.on == 'click'); }, show: function() { - return !$module.hasClass(className.disabled) && $item.length > 0; + return !module.is.disabled() && (module.has.items() || module.has.message()); }, useAPI: function() { return $.fn.api !== undefined; @@ -2810,14 +2816,18 @@ $.fn.dropdown = function(parameters) { }, hideAndClear: function() { - if(module.has.search()) { + if( module.has.maxSelections() ) { module.remove.searchTerm(); - module.hide(function() { - module.remove.filteredItem(); - }); } else { - module.hide(); + if(module.has.search()) { + module.hide(function() { + module.remove.filteredItem(); + }); + } + else { + module.hide(); + } } },