You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Igor Vaynberg (JIRA)" <ji...@apache.org> on 2009/02/01 20:01:59 UTC

[jira] Resolved: (WICKET-2005) pb to access to this on event onchange on the AutoCompleteTextField

     [ https://issues.apache.org/jira/browse/WICKET-2005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2005.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4-RC2
         Assignee: Igor Vaynberg

> pb to access to this on event onchange on the AutoCompleteTextField
> -------------------------------------------------------------------
>
>                 Key: WICKET-2005
>                 URL: https://issues.apache.org/jira/browse/WICKET-2005
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.4-RC1
>         Environment: Windows XP, Firefox 3.0, IE7, safari 3.0
>            Reporter: Olivier Dutrieux
>            Assignee: Igor Vaynberg
>             Fix For: 1.4-RC2
>
>         Attachments: screenshot-1.jpg, src.zip, wicket-autocomplete.js
>
>
> I would like create a component that extends AjaxEditableLabel with replace TextField with AjaxEditableAutoComplete.
> And I discovert a problem in the wicket-autocomplete.js when the event onchange is rewriting (line 83) :
> 83// WICKET-1280
> 84        objonchangeoriginal=obj.onchange; 
> 85        obj.onchange=function(event){
> 86      		if(mouseactive==1)return false;
> 87      		if(typeof objonchangeoriginal=="function")objonchangeoriginal();
> 88      	}
> 89        objonchange=obj.onchange;
> the problem is that the objonchangeoriginal function can't access to the this object, and it's necessary because I change the onchange event on AjaxEditableAutoComplete in case I extends AjaxEditableLabel with this :
> 	editor.add(new EditorAjaxBehavior()	{
> 			private static final long serialVersionUID = 1L;
> 			@Override
> 			protected void onComponentTag(ComponentTag tag) {
> 				super.onComponentTag(tag);
> 				final String saveCall = "{wicketAjaxGet('" + getCallbackUrl() +	"&save=true&'+this.name+'='+wicketEncode(this.value)); return true;}";
> 				tag.put("onchange", saveCall);
> 			}
> 		});
> then the best way to solve the problem is to change the invocation of objonchangeoriginal function with that :
> 83// WICKET-1280
> 84        objonchangeoriginal=obj.onchange; 
> 85        obj.onchange=function(event){
> 86      		if(mouseactive==1)return false;
> 87      		if(typeof objonchangeoriginal=="function")objonchangeoriginal.apply(this, [event]);
> 88      	}
> 89        objonchange=obj.onchange;
> all invocation of function need to be change this with new invocation on the wicket-autocomplete.js file
> You find on attach file a simple example that's show the problem. And my version of wicket-autocomplete.js that solve the problem.
> Duto

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