summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorPetr Voborník <pvoborni@redhat.com>2012-02-23 16:16:23 +0100
committerPetr Vobornik <pvoborni@redhat.com>2012-02-29 12:59:14 +0100
commit34f742bec2dec8fd4ade51946cd38b9dea123295 (patch)
tree5216321bad7590aff8484f537471c9e5a8f8a55d /install
parent87c2b00bf87d0973352761366002c00afbaa07af (diff)
downloadfreeipa-34f742bec2dec8fd4ade51946cd38b9dea123295.tar.gz
freeipa-34f742bec2dec8fd4ade51946cd38b9dea123295.tar.xz
freeipa-34f742bec2dec8fd4ade51946cd38b9dea123295.zip
Fixed selection of single value in combobox
When editable combobox had only one option and input field was cleared, the option couldn't be selected if it was selected before. This patch adds click handler to option elements. The handler calls select_on_change. When different option is selected select_on_change is executed twice. To avoid duplicate call of value_changed an open state of option area is checked. In first pass the area will be closed so it won't be executed in second. When selected option is clicked, only onclick handler is processed. This patch assumes that select event will be processed before click event. https://fedorahosted.org/freeipa/ticket/2070
Diffstat (limited to 'install')
-rw-r--r--install/ui/widget.js24
1 files changed, 15 insertions, 9 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 5ce7261e8..a54c9b826 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -2144,14 +2144,7 @@ IPA.combobox_widget = function(spec) {
name: 'list',
size: that.size,
style: 'width: 100%',
- change: function() {
- var value = $('option:selected', that.list).val();
- that.input.val(value);
- IPA.select_range(that.input, 0, 0);
-
- that.close();
- that.value_changed.notify([[value]], that);
- }
+ change: that.select_on_change
}).appendTo(div);
if (that.undo) {
@@ -2161,6 +2154,18 @@ IPA.combobox_widget = function(spec) {
that.create_error_link(container);
};
+ that.select_on_change = function() {
+
+ if (!that.is_open()) return;
+
+ var value = $('option:selected', that.list).val();
+ that.input.val(value);
+ IPA.select_range(that.input, 0, 0);
+
+ that.close();
+ that.value_changed.notify([[value]], that);
+ };
+
that.open = function() {
if (!that.read_only)
that.list_container.css('visibility', 'visible');
@@ -2281,7 +2286,8 @@ IPA.combobox_widget = function(spec) {
that.create_option = function(label, value) {
return $('<option/>', {
text: label,
- value: value
+ value: value,
+ click:that.select_on_change
}).appendTo(that.list);
};