From 30e0d24cc46eddb2c65ec623029cd74918f38d13 Mon Sep 17 00:00:00 2001 From: Patrick Cook Date: Mon, 17 Sep 2012 13:55:35 -0700 Subject: [PATCH 1/3] Made change to close dropdown if already open when clicking arrow --- jquery/js/jquery.combobox.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/jquery/js/jquery.combobox.js b/jquery/js/jquery.combobox.js index 8aaec45..a3859db 100644 --- a/jquery/js/jquery.combobox.js +++ b/jquery/js/jquery.combobox.js @@ -45,10 +45,13 @@ var thisSelector = this.selector; var thisCombobox = this; showSelectorButton.click(function (e) { - jQuery('html').trigger('click'); - thisSelector.buildSelectOptionList(); - thisSelector.show(); - thisCombobox.focus(); + if(thisSelector.isVisible() === false) { + thisSelector.buildSelectOptionList(); + thisSelector.show(); + thisCombobox.focus(); + } else { + thisSelector.hide(); + } return false; }); this.bindKeypress(); @@ -201,6 +204,7 @@ jQuery('html').keydown(this.keypressHandler); this.selectorElement.slideDown('fast'); jQuery('html').click(this.htmlClickHandler); + this.visible = true; return true; }, @@ -210,6 +214,11 @@ this.selectorElement.unbind('click'); this.unselect(); this.selectorElement.hide(); + this.visible = false; + }, + + isVisible : function () { + return this.visible === true; }, selectNext : function () { From ae3a026d1aa5fda7be5c332ed9726bd8c49bd264 Mon Sep 17 00:00:00 2001 From: Patrick Cook Date: Mon, 17 Sep 2012 14:42:03 -0700 Subject: [PATCH 2/3] Modified to read text of selected option instead of HTML --- jquery/js/jquery.combobox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery/js/jquery.combobox.js b/jquery/js/jquery.combobox.js index a3859db..93b7f31 100644 --- a/jquery/js/jquery.combobox.js +++ b/jquery/js/jquery.combobox.js @@ -183,7 +183,7 @@ var thisSelector = this; this.selectorElement.find('li').click(function (e) { thisSelector.hide(); - thisSelector.combobox.setValue(this.innerHTML); + thisSelector.combobox.setValue(jQuery(this).text()); thisSelector.combobox.focus(); }); this.selectorElement.mouseover(function (e) { @@ -250,7 +250,7 @@ getSelectedValue : function () { if(this.selectedIndex !== -1){ - return this.selectorElement.find('li').get(this.selectedIndex).innerHTML; + return jQuery(this.selectorElement.find('li').get(this.selectedIndex)).text(); } else { return this.combobox.textInputElement.val(); } From 2bbcdbd83f1eb59d91a55e8583cdce7d74fa4caa Mon Sep 17 00:00:00 2001 From: Patrick Cook Date: Mon, 17 Sep 2012 14:47:50 -0700 Subject: [PATCH 3/3] Revert "Modified to read text of selected option instead of HTML" Accidentally checked change into the wrong branch This reverts commit ae3a026d1aa5fda7be5c332ed9726bd8c49bd264. --- jquery/js/jquery.combobox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery/js/jquery.combobox.js b/jquery/js/jquery.combobox.js index 93b7f31..a3859db 100644 --- a/jquery/js/jquery.combobox.js +++ b/jquery/js/jquery.combobox.js @@ -183,7 +183,7 @@ var thisSelector = this; this.selectorElement.find('li').click(function (e) { thisSelector.hide(); - thisSelector.combobox.setValue(jQuery(this).text()); + thisSelector.combobox.setValue(this.innerHTML); thisSelector.combobox.focus(); }); this.selectorElement.mouseover(function (e) { @@ -250,7 +250,7 @@ getSelectedValue : function () { if(this.selectedIndex !== -1){ - return jQuery(this.selectorElement.find('li').get(this.selectedIndex)).text(); + return this.selectorElement.find('li').get(this.selectedIndex).innerHTML; } else { return this.combobox.textInputElement.val(); }