From 48401cec668a69bf6ebb4b8ad75a43fe51f628cf Mon Sep 17 00:00:00 2001 From: Marcos Mariano Date: Wed, 14 Jan 2015 18:46:26 -0200 Subject: [PATCH] Dropdown module (restore) This fix restores the input class "default" as well as removing the selected item from the list in case the default value is empty (used as placeholder) --- src/definitions/modules/dropdown.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 55c87f9b2..5cf7fed94 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -900,6 +900,7 @@ $.fn.dropdown = function(parameters) { ; module.debug('Restoring default text', defaultText); module.set.text(defaultText); + $text.addClass(settings.className.placeholder); }, defaultValue: function() { var @@ -907,8 +908,15 @@ $.fn.dropdown = function(parameters) { ; if(defaultValue !== undefined) { module.debug('Restoring default value', defaultValue); - module.set.selected(defaultValue); - module.set.value(defaultValue); + + if (defaultValue.length) { + module.set.selected(defaultValue); + module.set.value(defaultValue); + } + else { + module.remove.activeItem(); + module.remove.selectedItem(); + } } } },