You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Dipu C Seminlal (JIRA)" <ji...@apache.org> on 2007/05/30 10:20:15 UTC

[jira] Created: (WICKET-602) Highlighting/Preselecting the first item in the autocomplete list.

Highlighting/Preselecting the first item in the autocomplete list.
------------------------------------------------------------------

                 Key: WICKET-602
                 URL: https://issues.apache.org/jira/browse/WICKET-602
             Project: Wicket
          Issue Type: Improvement
          Components: wicket-extensions
            Reporter: Dipu C Seminlal


I have added a constructor to the Autocomplete textbox where we can specify if we need preselecting
public AutoCompleteTextField(String id,boolean preselect)
{
		this(id, (IModel)null,preselect);

}

please find the patch for the same below

Index: C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java
===================================================================
--- C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java	(revision 541579)
+++ C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java	(working copy)
@@ -34,6 +34,7 @@
 	private static final ResourceReference AUTOCOMPLETE_JS = new CompressedResourceReference(
 			AutoCompleteBehavior.class, "wicket-autocomplete.js");
 
+	protected boolean preselect = false;
 	/**
 	 * 
 	 */
@@ -66,7 +67,7 @@
 		Response response = getComponent().getResponse();
 		final String id = getComponent().getMarkupId();
 		response.write(JavascriptUtils.SCRIPT_OPEN_TAG);
-		response.write("new Wicket.AutoComplete('" + id + "','" + getCallbackUrl() + "');");
+		response.write("new Wicket.AutoComplete('" + id + "','" + getCallbackUrl() +"',"+ preselect + ");");
 		response.write(JavascriptUtils.SCRIPT_CLOSE_TAG);
 	}
 
Index: C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteBehavior.java
===================================================================
--- C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteBehavior.java	(revision 541579)
+++ C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteBehavior.java	(working copy)
@@ -49,6 +49,19 @@
 	 */
 	public AutoCompleteBehavior(IAutoCompleteRenderer renderer)
 	{
+		this(renderer, false);
+	}
+
+
+	/**
+	 * Constructor
+	 * 
+	 * @param renderer
+	 *            renderer that will be used to generate output
+	 * @param preselect 
+	 */
+	public AutoCompleteBehavior(IAutoCompleteRenderer renderer, boolean preselect)
+	{
 		if (renderer == null)
 		{
 			throw new IllegalArgumentException("renderer cannot be null");
@@ -54,6 +67,7 @@
 			throw new IllegalArgumentException("renderer cannot be null");
 		}
 		this.renderer = renderer;
+		this.preselect = preselect;
 	}
 
 
Index: C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteTextField.java
===================================================================
--- C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteTextField.java	(revision 541579)
+++ C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteTextField.java	(working copy)
@@ -43,7 +43,7 @@
 	 */
 	public AutoCompleteTextField(String id, Class type)
 	{
-		this(id, (IModel)null, type);
+		this(id, (IModel)null, type,false);
 	}
 
 	/**
@@ -50,10 +50,11 @@
 	 * @param id
 	 * @param model
 	 * @param type
+	 * @param preselect 
 	 */
-	public AutoCompleteTextField(String id, IModel model, Class type)
+	public AutoCompleteTextField(String id, IModel model, Class type,boolean preselect)
 	{
-		this(id, model, type, StringAutoCompleteRenderer.INSTANCE);
+		this(id, model, type, StringAutoCompleteRenderer.INSTANCE,preselect);
 
 	}
 
@@ -60,10 +61,21 @@
 	/**
 	 * @param id
 	 * @param object
+	 * @param preselect 
+	 */
+	public AutoCompleteTextField(String id, IModel object,boolean preselect)
+	{
+		this(id, object, (Class)null,preselect);
+	}
+
+	
+	/**
+	 * @param id
+	 * @param object
 	 */
 	public AutoCompleteTextField(String id, IModel object)
 	{
-		this(id, object, (Class)null);
+		this(id, object, (Class)null,false);
 	}
 
 	/**
@@ -68,10 +80,20 @@
 
 	/**
 	 * @param id
+	 * @param preselect 
+	 */
+	public AutoCompleteTextField(String id,boolean preselect)
+	{
+		this(id, (IModel)null,preselect);
+
+	}
+	
+	/**
+	 * @param id
 	 */
 	public AutoCompleteTextField(String id)
 	{
-		this(id, (IModel)null);
+		this(id, (IModel)null,false);
 
 	}
 
@@ -91,7 +113,7 @@
 	 */
 	public AutoCompleteTextField(String id, Class type, IAutoCompleteRenderer renderer)
 	{
-		this(id, null, type, renderer);
+		this(id, null, type, renderer,false);
 	}
 
 	/**
@@ -101,7 +123,7 @@
 	 */
 	public AutoCompleteTextField(String id, IModel model, IAutoCompleteRenderer renderer)
 	{
-		this(id, model, (Class)null, renderer);
+		this(id, model, (Class)null, renderer,false);
 	}
 
 	/**
@@ -109,8 +131,9 @@
 	 * @param model
 	 * @param type
 	 * @param renderer
+	 * @param preselect 
 	 */
-	public AutoCompleteTextField(String id, IModel model, Class type, IAutoCompleteRenderer renderer)
+	public AutoCompleteTextField(String id, IModel model, Class type, IAutoCompleteRenderer renderer,boolean preselect)
 	{
 		super(id, model, type);
 
@@ -117,7 +140,7 @@
 		// this disables Firefox autocomplete
 		add(new SimpleAttributeModifier("autocomplete","off"));
 		
-		add(new AutoCompleteBehavior(renderer)
+		add(new AutoCompleteBehavior(renderer,preselect)
 		{
 
 			private static final long serialVersionUID = 1L;
Index: C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
===================================================================
--- C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js	(revision 541579)
+++ C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js	(working copy)
@@ -7,7 +7,7 @@
 if (typeof(Wicket) == "undefined")
 	Wicket = { };
 
-Wicket.AutoComplete=function(elementId,callbackUrl){
+Wicket.AutoComplete=function(elementId,callbackUrl,preselect){
     var KEY_BACKSPACE=8;
     var KEY_TAB=9;
     var KEY_ENTER=13;
@@ -167,8 +167,12 @@
     }
 
     function updateChoices(){
-        selected=-1;
-
+        if(preselect==true){
+        	selected = 0;
+        }
+        else{
+        	selected=-1;
+        }        
         var value = wicketGet(elementId).value;
        	var request = new Wicket.Ajax.Request(callbackUrl+"&q="+processValue(value), doUpdateChoices, false, true, false, "wicket-autocomplete|d");
        	request.get();



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-602) Highlighting/Preselecting the first item in the autocomplete list.

Posted by "Janne Hietamäki (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-602?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Janne Hietamäki resolved WICKET-602.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3.0-rc1

Committed the patch. Sorry for the delay, I missed this because the task was assigned to Matej.



> Highlighting/Preselecting the first item in the autocomplete list.
> ------------------------------------------------------------------
>
>                 Key: WICKET-602
>                 URL: https://issues.apache.org/jira/browse/WICKET-602
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>            Reporter: Dipu C Seminlal
>            Assignee: Janne Hietamäki
>             Fix For: 1.3.0-rc1
>
>         Attachments: autocomplete-patch.txt
>
>
> It would be nice to have the ability to specify when we construct the AutoCompleteTextField that if we need to highlight/preselect the first item in the autocomplete list
> I have added a constructor to the Autocomplete textbox where we can specify if we need preselecting 
> public AutoCompleteTextField(String id,boolean preselect)
> {
> 		this(id, (IModel)null,preselect);
> }
> and has made the corresponding changes in the Behaviours and the autocomplete js file.
> Please find the patch attached with this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WICKET-602) Highlighting/Preselecting the first item in the autocomplete list.

Posted by "Janne Hietamäki (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-602?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Janne Hietamäki reassigned WICKET-602:
--------------------------------------

    Assignee: Janne Hietamäki  (was: Matej Knopp)

> Highlighting/Preselecting the first item in the autocomplete list.
> ------------------------------------------------------------------
>
>                 Key: WICKET-602
>                 URL: https://issues.apache.org/jira/browse/WICKET-602
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>            Reporter: Dipu C Seminlal
>            Assignee: Janne Hietamäki
>         Attachments: autocomplete-patch.txt
>
>
> It would be nice to have the ability to specify when we construct the AutoCompleteTextField that if we need to highlight/preselect the first item in the autocomplete list
> I have added a constructor to the Autocomplete textbox where we can specify if we need preselecting 
> public AutoCompleteTextField(String id,boolean preselect)
> {
> 		this(id, (IModel)null,preselect);
> }
> and has made the corresponding changes in the Behaviours and the autocomplete js file.
> Please find the patch attached with this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-602) Highlighting/Preselecting the first item in the autocomplete list.

Posted by "Sean Sullivan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505949 ] 

Sean Sullivan commented on WICKET-602:
--------------------------------------

I'd love to have this feature in Wicket 1.3   

Will you be able to commit the code before Wicket 1.3 beta 2?


> Highlighting/Preselecting the first item in the autocomplete list.
> ------------------------------------------------------------------
>
>                 Key: WICKET-602
>                 URL: https://issues.apache.org/jira/browse/WICKET-602
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>            Reporter: Dipu C Seminlal
>            Assignee: Matej Knopp
>         Attachments: autocomplete-patch.txt
>
>
> It would be nice to have the ability to specify when we construct the AutoCompleteTextField that if we need to highlight/preselect the first item in the autocomplete list
> I have added a constructor to the Autocomplete textbox where we can specify if we need preselecting 
> public AutoCompleteTextField(String id,boolean preselect)
> {
> 		this(id, (IModel)null,preselect);
> }
> and has made the corresponding changes in the Behaviours and the autocomplete js file.
> Please find the patch attached with this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-602) Highlighting/Preselecting the first item in the autocomplete list.

Posted by "Janne Hietamäki (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500068 ] 

Janne Hietamäki commented on WICKET-602:
----------------------------------------

It seems this patch is for 1.2. 

I would not like to add any features to the 1.2, but it would be ok to include this into 1.3. Does that help you?

> Highlighting/Preselecting the first item in the autocomplete list.
> ------------------------------------------------------------------
>
>                 Key: WICKET-602
>                 URL: https://issues.apache.org/jira/browse/WICKET-602
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>            Reporter: Dipu C Seminlal
>         Attachments: autocomplete-patch.txt
>
>
> It would be nice to have the ability to specify when we construct the AutoCompleteTextField that if we need to highlight/preselect the first item in the autocomplete list
> I have added a constructor to the Autocomplete textbox where we can specify if we need preselecting 
> public AutoCompleteTextField(String id,boolean preselect)
> {
> 		this(id, (IModel)null,preselect);
> }
> and has made the corresponding changes in the Behaviours and the autocomplete js file.
> Please find the patch attached with this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-602) Highlighting/Preselecting the first item in the autocomplete list.

Posted by "Sean Sullivan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509330 ] 

Sean Sullivan commented on WICKET-602:
--------------------------------------

Will this patch make it into the Wicket 1.3 final release?


> Highlighting/Preselecting the first item in the autocomplete list.
> ------------------------------------------------------------------
>
>                 Key: WICKET-602
>                 URL: https://issues.apache.org/jira/browse/WICKET-602
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>            Reporter: Dipu C Seminlal
>            Assignee: Matej Knopp
>         Attachments: autocomplete-patch.txt
>
>
> It would be nice to have the ability to specify when we construct the AutoCompleteTextField that if we need to highlight/preselect the first item in the autocomplete list
> I have added a constructor to the Autocomplete textbox where we can specify if we need preselecting 
> public AutoCompleteTextField(String id,boolean preselect)
> {
> 		this(id, (IModel)null,preselect);
> }
> and has made the corresponding changes in the Behaviours and the autocomplete js file.
> Please find the patch attached with this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-602) Highlighting/Preselecting the first item in the autocomplete list.

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-602?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alastair Maw updated WICKET-602:
--------------------------------

    Fix Version/s:     (was: 1.3.0-rc1)
                   1.3.0-beta3

> Highlighting/Preselecting the first item in the autocomplete list.
> ------------------------------------------------------------------
>
>                 Key: WICKET-602
>                 URL: https://issues.apache.org/jira/browse/WICKET-602
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>            Reporter: Dipu C Seminlal
>            Assignee: Janne Hietamäki
>             Fix For: 1.3.0-beta3
>
>         Attachments: autocomplete-patch.txt
>
>
> It would be nice to have the ability to specify when we construct the AutoCompleteTextField that if we need to highlight/preselect the first item in the autocomplete list
> I have added a constructor to the Autocomplete textbox where we can specify if we need preselecting 
> public AutoCompleteTextField(String id,boolean preselect)
> {
> 		this(id, (IModel)null,preselect);
> }
> and has made the corresponding changes in the Behaviours and the autocomplete js file.
> Please find the patch attached with this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-602) Highlighting/Preselecting the first item in the autocomplete list.

Posted by "Dipu C Seminlal (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-602?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dipu C Seminlal updated WICKET-602:
-----------------------------------

    Description: 
It would be nice to have the ability to specify when we construct the AutoCompleteTextField that if we need to highlight/preselect the first item in the autocomplete list

I have added a constructor to the Autocomplete textbox where we can specify if we need preselecting 

public AutoCompleteTextField(String id,boolean preselect)
{
		this(id, (IModel)null,preselect);

}

and has made the corresponding changes in the Behaviours and the autocomplete js file.
Please find the patch attached with this issue.






  was:
I have added a constructor to the Autocomplete textbox where we can specify if we need preselecting
public AutoCompleteTextField(String id,boolean preselect)
{
		this(id, (IModel)null,preselect);

}

please find the patch for the same below

Index: C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java
===================================================================
--- C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java	(revision 541579)
+++ C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AbstractAutoCompleteBehavior.java	(working copy)
@@ -34,6 +34,7 @@
 	private static final ResourceReference AUTOCOMPLETE_JS = new CompressedResourceReference(
 			AutoCompleteBehavior.class, "wicket-autocomplete.js");
 
+	protected boolean preselect = false;
 	/**
 	 * 
 	 */
@@ -66,7 +67,7 @@
 		Response response = getComponent().getResponse();
 		final String id = getComponent().getMarkupId();
 		response.write(JavascriptUtils.SCRIPT_OPEN_TAG);
-		response.write("new Wicket.AutoComplete('" + id + "','" + getCallbackUrl() + "');");
+		response.write("new Wicket.AutoComplete('" + id + "','" + getCallbackUrl() +"',"+ preselect + ");");
 		response.write(JavascriptUtils.SCRIPT_CLOSE_TAG);
 	}
 
Index: C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteBehavior.java
===================================================================
--- C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteBehavior.java	(revision 541579)
+++ C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteBehavior.java	(working copy)
@@ -49,6 +49,19 @@
 	 */
 	public AutoCompleteBehavior(IAutoCompleteRenderer renderer)
 	{
+		this(renderer, false);
+	}
+
+
+	/**
+	 * Constructor
+	 * 
+	 * @param renderer
+	 *            renderer that will be used to generate output
+	 * @param preselect 
+	 */
+	public AutoCompleteBehavior(IAutoCompleteRenderer renderer, boolean preselect)
+	{
 		if (renderer == null)
 		{
 			throw new IllegalArgumentException("renderer cannot be null");
@@ -54,6 +67,7 @@
 			throw new IllegalArgumentException("renderer cannot be null");
 		}
 		this.renderer = renderer;
+		this.preselect = preselect;
 	}
 
 
Index: C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteTextField.java
===================================================================
--- C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteTextField.java	(revision 541579)
+++ C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteTextField.java	(working copy)
@@ -43,7 +43,7 @@
 	 */
 	public AutoCompleteTextField(String id, Class type)
 	{
-		this(id, (IModel)null, type);
+		this(id, (IModel)null, type,false);
 	}
 
 	/**
@@ -50,10 +50,11 @@
 	 * @param id
 	 * @param model
 	 * @param type
+	 * @param preselect 
 	 */
-	public AutoCompleteTextField(String id, IModel model, Class type)
+	public AutoCompleteTextField(String id, IModel model, Class type,boolean preselect)
 	{
-		this(id, model, type, StringAutoCompleteRenderer.INSTANCE);
+		this(id, model, type, StringAutoCompleteRenderer.INSTANCE,preselect);
 
 	}
 
@@ -60,10 +61,21 @@
 	/**
 	 * @param id
 	 * @param object
+	 * @param preselect 
+	 */
+	public AutoCompleteTextField(String id, IModel object,boolean preselect)
+	{
+		this(id, object, (Class)null,preselect);
+	}
+
+	
+	/**
+	 * @param id
+	 * @param object
 	 */
 	public AutoCompleteTextField(String id, IModel object)
 	{
-		this(id, object, (Class)null);
+		this(id, object, (Class)null,false);
 	}
 
 	/**
@@ -68,10 +80,20 @@
 
 	/**
 	 * @param id
+	 * @param preselect 
+	 */
+	public AutoCompleteTextField(String id,boolean preselect)
+	{
+		this(id, (IModel)null,preselect);
+
+	}
+	
+	/**
+	 * @param id
 	 */
 	public AutoCompleteTextField(String id)
 	{
-		this(id, (IModel)null);
+		this(id, (IModel)null,false);
 
 	}
 
@@ -91,7 +113,7 @@
 	 */
 	public AutoCompleteTextField(String id, Class type, IAutoCompleteRenderer renderer)
 	{
-		this(id, null, type, renderer);
+		this(id, null, type, renderer,false);
 	}
 
 	/**
@@ -101,7 +123,7 @@
 	 */
 	public AutoCompleteTextField(String id, IModel model, IAutoCompleteRenderer renderer)
 	{
-		this(id, model, (Class)null, renderer);
+		this(id, model, (Class)null, renderer,false);
 	}
 
 	/**
@@ -109,8 +131,9 @@
 	 * @param model
 	 * @param type
 	 * @param renderer
+	 * @param preselect 
 	 */
-	public AutoCompleteTextField(String id, IModel model, Class type, IAutoCompleteRenderer renderer)
+	public AutoCompleteTextField(String id, IModel model, Class type, IAutoCompleteRenderer renderer,boolean preselect)
 	{
 		super(id, model, type);
 
@@ -117,7 +140,7 @@
 		// this disables Firefox autocomplete
 		add(new SimpleAttributeModifier("autocomplete","off"));
 		
-		add(new AutoCompleteBehavior(renderer)
+		add(new AutoCompleteBehavior(renderer,preselect)
 		{
 
 			private static final long serialVersionUID = 1L;
Index: C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
===================================================================
--- C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js	(revision 541579)
+++ C:/wicket/wicket-svn/releases/wicket-1.2.6/wicket-extensions/src/main/java/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js	(working copy)
@@ -7,7 +7,7 @@
 if (typeof(Wicket) == "undefined")
 	Wicket = { };
 
-Wicket.AutoComplete=function(elementId,callbackUrl){
+Wicket.AutoComplete=function(elementId,callbackUrl,preselect){
     var KEY_BACKSPACE=8;
     var KEY_TAB=9;
     var KEY_ENTER=13;
@@ -167,8 +167,12 @@
     }
 
     function updateChoices(){
-        selected=-1;
-
+        if(preselect==true){
+        	selected = 0;
+        }
+        else{
+        	selected=-1;
+        }        
         var value = wicketGet(elementId).value;
        	var request = new Wicket.Ajax.Request(callbackUrl+"&q="+processValue(value), doUpdateChoices, false, true, false, "wicket-autocomplete|d");
        	request.get();




> Highlighting/Preselecting the first item in the autocomplete list.
> ------------------------------------------------------------------
>
>                 Key: WICKET-602
>                 URL: https://issues.apache.org/jira/browse/WICKET-602
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>            Reporter: Dipu C Seminlal
>
> It would be nice to have the ability to specify when we construct the AutoCompleteTextField that if we need to highlight/preselect the first item in the autocomplete list
> I have added a constructor to the Autocomplete textbox where we can specify if we need preselecting 
> public AutoCompleteTextField(String id,boolean preselect)
> {
> 		this(id, (IModel)null,preselect);
> }
> and has made the corresponding changes in the Behaviours and the autocomplete js file.
> Please find the patch attached with this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-602) Highlighting/Preselecting the first item in the autocomplete list.

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-602?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alastair Maw updated WICKET-602:
--------------------------------

    Assignee: Matej Knopp

> Highlighting/Preselecting the first item in the autocomplete list.
> ------------------------------------------------------------------
>
>                 Key: WICKET-602
>                 URL: https://issues.apache.org/jira/browse/WICKET-602
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>            Reporter: Dipu C Seminlal
>            Assignee: Matej Knopp
>         Attachments: autocomplete-patch.txt
>
>
> It would be nice to have the ability to specify when we construct the AutoCompleteTextField that if we need to highlight/preselect the first item in the autocomplete list
> I have added a constructor to the Autocomplete textbox where we can specify if we need preselecting 
> public AutoCompleteTextField(String id,boolean preselect)
> {
> 		this(id, (IModel)null,preselect);
> }
> and has made the corresponding changes in the Behaviours and the autocomplete js file.
> Please find the patch attached with this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-602) Highlighting/Preselecting the first item in the autocomplete list.

Posted by "Dipu C Seminlal (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-602?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dipu C Seminlal updated WICKET-602:
-----------------------------------

    Attachment: autocomplete-patch.txt

> Highlighting/Preselecting the first item in the autocomplete list.
> ------------------------------------------------------------------
>
>                 Key: WICKET-602
>                 URL: https://issues.apache.org/jira/browse/WICKET-602
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>            Reporter: Dipu C Seminlal
>         Attachments: autocomplete-patch.txt
>
>
> It would be nice to have the ability to specify when we construct the AutoCompleteTextField that if we need to highlight/preselect the first item in the autocomplete list
> I have added a constructor to the Autocomplete textbox where we can specify if we need preselecting 
> public AutoCompleteTextField(String id,boolean preselect)
> {
> 		this(id, (IModel)null,preselect);
> }
> and has made the corresponding changes in the Behaviours and the autocomplete js file.
> Please find the patch attached with this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.