Browse Source

Dropdown clear now removes selected value

pull/1729/head
jlukic 9 years ago
parent
commit
b86b5ced86
2 changed files with 5 additions and 3 deletions
  1. 2
      RELEASE-NOTES.md
  2. 6
      src/definitions/modules/dropdown.js

2
RELEASE-NOTES.md

@ -5,7 +5,7 @@
**Key Features**
- **Form** - Form now has new methods `reset`, `clear`, `set value(s)`, and `read value(s)` for modifying and reading form data. Check docs for details on implementation. **Thanks @mktm**
- **Search** - Search `onSelect` now recieves JSON object matching currently selected element, you can now programmatically retrieve result JSON using `.search('get result', 'query')` or `.search('get results'). `get result` will default to current value unless specified as first parameter.
- **Search** - Search `onSelect` now recieves JSON object matching currently selected element, you can now programmatically retrieve result JSON using `.search('get result', 'query')` or `.search('get results')`. `get result` will default to current value unless specified as first parameter.
- **Transition** - Added many new transitions, and new directions for existing transitions **Thanks @ph7vc**
- **Dropdown** - Dropdown now stores `placeholder text` (prompt text) as separate from `default text` (text set on page load). You can now reset placeholder conditions using `$('.ui.dropdown').dropdown('clear');``

6
src/definitions/modules/dropdown.js

@ -831,7 +831,7 @@ $.fn.dropdown = function(parameters) {
}
},
choiceValue: function($choice, choiceText) {
choiceText = choiceText || module.get.choiceText($text);
choiceText = choiceText || module.get.choiceText($choice);
return ($choice.data(metadata.value) !== undefined)
? $choice.data(metadata.value)
: (typeof choiceText === 'string')
@ -1009,6 +1009,8 @@ $.fn.dropdown = function(parameters) {
;
module.set.text(placeholderText);
module.set.value('');
module.remove.activeItem();
module.remove.selectedItem();
$text.addClass(className.placeholder);
},
@ -1151,7 +1153,7 @@ $.fn.dropdown = function(parameters) {
.addClass(className.selected)
;
selectedText = module.get.choiceText($selectedItem);
selectedValue = module.get.choiceValue($selectedItem);
selectedValue = module.get.choiceValue($selectedItem, selectedText);
module.set.text(selectedText);
module.set.value(selectedValue);
settings.onChange.call(element, value, selectedText, $selectedItem);

Loading…
Cancel
Save