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

--
Endi S. Dewata
From 139db5e14fe76d7eb13567ddbf4eb4c8ebf1486c Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
Date: Tue, 20 Sep 2011 15:12:05 -0500
Subject: [PATCH] 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
---
 install/ui/widget.js |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/install/ui/widget.js b/install/ui/widget.js
index fde6b0f2150da9f307922c5b06f5a9320b6b852d..8d425412de05308bf2fa886a6e0eed6aae61e597 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -1669,12 +1669,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);
@@ -1684,12 +1679,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);
@@ -1805,11 +1795,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());
-- 
1.7.5.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to