Don't force highlight nothing element
Causes "Uncaught TypeError: Cannot read property 'element' of undefined at DecoratedClass.SelectOnClose._handleSelectOnClose" Refs #4867
This commit is contained in:
parent
64d7464ed3
commit
d46accfc4f
|
|
@ -126,8 +126,10 @@
|
|||
extraOptions.minimumInputLength = 1
|
||||
|
||||
$element.on('select2:closing', function() {
|
||||
$('.select2-dropdown.select-no-dropdown:first .select2-results__option--highlighted').removeClass('select2-results__option--highlighted')
|
||||
$('.select2-dropdown.select-no-dropdown:first .select2-results__option:first').addClass('select2-results__option--highlighted')
|
||||
if ($('.select2-dropdown.select-no-dropdown:first .select2-results__option--highlighted').length > 0) {
|
||||
$('.select2-dropdown.select-no-dropdown:first .select2-results__option--highlighted').removeClass('select2-results__option--highlighted')
|
||||
$('.select2-dropdown.select-no-dropdown:first .select2-results__option:first').addClass('select2-results__option--highlighted')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3527,8 +3527,8 @@ extraOptions.tokenSeparators=separators.split('|')
|
|||
if($element.hasClass('select-no-dropdown')){extraOptions.selectOnClose=true
|
||||
extraOptions.closeOnSelect=false
|
||||
extraOptions.minimumInputLength=1
|
||||
$element.on('select2:closing',function(){$('.select2-dropdown.select-no-dropdown:first .select2-results__option--highlighted').removeClass('select2-results__option--highlighted')
|
||||
$('.select2-dropdown.select-no-dropdown:first .select2-results__option:first').addClass('select2-results__option--highlighted')})}}
|
||||
$element.on('select2:closing',function(){if($('.select2-dropdown.select-no-dropdown:first .select2-results__option--highlighted').length>0){$('.select2-dropdown.select-no-dropdown:first .select2-results__option--highlighted').removeClass('select2-results__option--highlighted')
|
||||
$('.select2-dropdown.select-no-dropdown:first .select2-results__option:first').addClass('select2-results__option--highlighted')}})}}
|
||||
var placeholder=$element.data('placeholder')
|
||||
if(placeholder){extraOptions.placeholder=placeholder
|
||||
extraOptions.allowClear=true}
|
||||
|
|
|
|||
Loading…
Reference in New Issue