summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-09-20 15:12:05 -0500
committerEndi S. Dewata <edewata@redhat.com>2011-09-23 13:15:57 +0000
commiteaf0a83ab1388310b65f2d781ea27a61c9678f5d (patch)
treefae79eef17db1528375f8a82906cde397d5946ab
parent8e95d1eb4e916c5fb218d161f568afaac0a06f0f (diff)
downloadfreeipa-eaf0a83ab1388310b65f2d781ea27a61c9678f5d.tar.gz
freeipa-eaf0a83ab1388310b65f2d781ea27a61c9678f5d.tar.xz
freeipa-eaf0a83ab1388310b65f2d781ea27a61c9678f5d.zip
Fixed problem on combobox with search limit.
The IPA.combobox_widget has been modified such that if the drop-down list doesn't contain the stored value (due to search limit) it will not select anything from the list. The widget has also been modified not to select the value that matches the filter automatically because that might not be the user's intention. Ticket #1819
-rw-r--r--install/ui/widget.js19
1 files changed, 7 insertions, 12 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 4a02cb7d8..0c07d655d 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -1670,12 +1670,7 @@ IPA.combobox_widget = function(spec) {
keypress: function(e) {
if (e.which == 13) { // Enter
var filter = that.filter.val();
- that.search(
- filter,
- function(data, text_status, xhr) {
- that.select(filter);
- }
- );
+ that.search(filter);
}
}
}).appendTo(div);
@@ -1685,12 +1680,7 @@ IPA.combobox_widget = function(spec) {
icon: 'search-icon',
click: function() {
var filter = that.filter.val();
- that.search(
- filter,
- function(data, text_status, xhr) {
- that.select(filter);
- }
- );
+ that.search(filter);
return false;
}
}).appendTo(div);
@@ -1783,11 +1773,16 @@ IPA.combobox_widget = function(spec) {
var option;
if (value) {
+ // select specified value
option = $('option[value="'+value+'"]', that.list);
} else {
+ // select first available option
option = $('option', that.list).first();
}
+ // if no option found, skip
+ if (!option.length) return;
+
option.attr('selected', 'selected');
that.set_value(option.val());