Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dropdown] Allow ignoring of case when getting an item #3432

Merged
merged 2 commits into from
Jan 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -1877,6 +1877,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 @@ -1894,6 +1898,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 @@ -3618,7 +3630,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