Browse Source

Adds #2083, search can specify whether to match on text, value or both

pull/2092/head
jlukic 10 years ago
parent
commit
5c538e70f2
1 changed files with 25 additions and 6 deletions
  1. 31
      src/definitions/modules/dropdown.js

31
src/definitions/modules/dropdown.js

@ -454,15 +454,32 @@ $.fn.dropdown = function(parameters) {
.each(function(){ .each(function(){
var var
$choice = $(this), $choice = $(this),
text = String(module.get.choiceText($choice, false)),
value = String(module.get.choiceValue($choice, text))
text,
value
; ;
if( text.match(exactRegExp) || value.match(exactRegExp) ) {
$results = $results.add($choice);
if(settings.match == 'both' || settings.match == 'text') {
text = String(module.get.choiceText($choice, false));
if(text.match(exactRegExp)) {
$results = $results.add($choice);
return true;
}
else if(settings.fullTextSearch && text.match(fullTextRegExp)) {
$results = $results.add($choice);
return true;
}
} }
else if(settings.fullTextSearch) {
if( text.match(fullTextRegExp) || value.match(fullTextRegExp) ) {
if(settings.match == 'both' || settings.match == 'value') {
console.log('here');
value = String(module.get.choiceValue($choice, text));
if(value.match(exactRegExp)) {
$results = $results.add($choice);
return true;
}
else if(settings.fullTextSearch && value.match(fullTextRegExp)) {
$results = $results.add($choice); $results = $results.add($choice);
return true;
} }
} }
}) })
@ -2088,6 +2105,8 @@ $.fn.dropdown.settings = {
variation : false variation : false
}, },
match: 'both',
allowCategorySelection : false, allowCategorySelection : false,
delay : { delay : {

Loading…
Cancel
Save