Browse Source

Dropdown: Fixes issue where last matching item was found, without prioritizing value over text #502

pull/524/head
jlukic 10 years ago
parent
commit
cf6f6abcef
1 changed files with 5 additions and 3 deletions
  1. 8
      src/modules/dropdown.js

8
src/modules/dropdown.js

@ -325,7 +325,7 @@ $.fn.dropdown = function(parameters) {
}, },
item: function(value) { item: function(value) {
var var
$selectedItem
$selectedItem = false
; ;
value = (value !== undefined) value = (value !== undefined)
? value ? value
@ -345,9 +345,11 @@ $.fn.dropdown = function(parameters) {
? $choice.data(metadata.value) ? $choice.data(metadata.value)
: optionText.toLowerCase() : optionText.toLowerCase()
; ;
if( optionValue == value || optionText == value ) {
if( optionValue == value ) {
$selectedItem = $(this);
}
else if( !$selectedItem && optionText == value ) {
$selectedItem = $(this); $selectedItem = $(this);
return false;
} }
}) })
; ;

Loading…
Cancel
Save