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:34:18 UTC

[2/2] 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

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)

Conflicts:
	wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js


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

Branch: refs/heads/master
Commit: d4886b438a02fd1bd19592b1307eb58643ff74e9
Parents: b970262
Author: Johan Compagner <jc...@apache.org>
Authored: Fri May 4 14:31:01 2012 +0200
Committer: Johan Compagner <jc...@apache.org>
Committed: Fri May 4 14:31:01 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/d4886b43/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 1ceb76d..abf470b 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
@@ -363,7 +363,7 @@ Wicket.AutoComplete=function(elementId, callbackUrl, cfg, indicatorId){
 			dt: 'html',
 			ep: {},
 			wr: false,
-			sh: [ doUpdateChoices ]
+			sh: [ doUpdateAllChoices ]
 		};
 		attrs.ep[paramName] = '';
 		Wicket.Ajax.ajax(attrs);
@@ -587,7 +587,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;
     	
@@ -645,7 +648,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'];