You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2012/05/04 14:21:20 UTC

git commit: When showing all then only select if it really is in the list if filtering (typing) then select the first one by default This fixes the behavior that when tabbing through fields that suddenly the first value overwrites the real selected value

Updated Branches:
  refs/heads/wicket-1.4.x 5e2cf48ea -> 62c234ec4


When showing all then only select if it really is in the list
if filtering (typing) then select the first one by default
This fixes the behavior that when tabbing through fields that suddenly
the first value overwrites the real selected value if the real selected
value was not in the list yet (because the data is to big)

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/62c234ec
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/62c234ec
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/62c234ec

Branch: refs/heads/wicket-1.4.x
Commit: 62c234ec436dd59b38c5bff79acd4afae5a0e1a8
Parents: 5e2cf48
Author: Johan Compagner <jc...@apache.org>
Authored: Fri May 4 14:20:45 2012 +0200
Committer: Johan Compagner <jc...@apache.org>
Committed: Fri May 4 14:20:45 2012 +0200

----------------------------------------------------------------------
 .../html/autocomplete/wicket-autocomplete.js       |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/62c234ec/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
----------------------------------------------------------------------
diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
index 1293a51..cdf15bc 100644
--- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
+++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
@@ -358,7 +358,7 @@ Wicket.AutoComplete=function(elementId, callbackUrl, cfg, indicatorId){
     function actualUpdateChoicesShowAll()
     {
     	showIndicator();
-       	var request = new Wicket.Ajax.Request(callbackUrl+"&q=", doUpdateChoices, false, true, false, "wicket-autocomplete|d");
+       	var request = new Wicket.Ajax.Request(callbackUrl+"&q=", doUpdateAllChoices, false, true, false, "wicket-autocomplete|d");
        	request.get();
     }
 
@@ -580,7 +580,10 @@ Wicket.AutoComplete=function(elementId, callbackUrl, cfg, indicatorId){
         return [leftPosition,topPosition];
     }
     
-    function doUpdateChoices(resp){
+    function doUpdateAllChoices(resp) {
+    	doUpdateChoices(resp,-1);
+    }
+    function doUpdateChoices(resp, defaultSelection){
     	
     	getAutocompleteMenu().showingAutocomplete = false;
     	
@@ -638,7 +641,7 @@ Wicket.AutoComplete=function(elementId, callbackUrl, cfg, indicatorId){
 
         if(elementCount>0){
             if(cfg.preselect==true){
-                var selectedIndex = 0;
+                var selectedIndex = defaultSelection?defaultSelection:0;
                 for(var i = 0;i < elementCount; i++) {
                	 	var node = selectableElements[i];
                	 	var attr= node.attributes['textvalue'];