Skip to content

Commit

Permalink
Merge pull request #3432 from Neaox/patch-1
Browse files Browse the repository at this point in the history
[Dropdown] Allow ignoring of case when getting an item
  • Loading branch information
jlukic authored Jan 29, 2018
2 parents 7c691d2 + ecf65b6 commit 6b86819
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -1915,6 +1915,10 @@ $.fn.dropdown = function(parameters) {
? module.get.values()
: module.get.text()
;
value = (typeof value === "string" && settings.ignoresCase)
? value.toLowerCase()
: value
;
shouldSearch = (isMultiple)
? (value.length > 0)
: (value !== undefined && value !== null)
Expand All @@ -1932,6 +1936,14 @@ $.fn.dropdown = function(parameters) {
optionText = module.get.choiceText($choice),
optionValue = module.get.choiceValue($choice, optionText)
;
optionText = (typeof optionText === "string" && settings.ignoresCase)
? optionText.toLowerCase()
: optionText
;
optionValue = (typeof optionValue === "string" && settings.ignoresCase)
? optionValue.toLowerCase()
: optionValue
;
// safe early exit
if(optionValue === null || optionValue === undefined) {
return;
Expand Down Expand Up @@ -3684,7 +3696,8 @@ $.fn.dropdown.settings = {

transition : 'auto', // auto transition will slide down or up based on direction
duration : 200, // duration of transition


ignoresCase : false, // when determining if an item exists or not ignore case of value and label when comparing
glyphWidth : 1.037, // widest glyph width in em (W is 1.037 em) used to calculate multiselect input width

// label settings on multi-select
Expand Down

0 comments on commit 6b86819

Please sign in to comment.