wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Dutrieux <dutri...@pasteur.fr>
Subject pb to access to this on event onchange on the AutoCompleteTextField
Date Sun, 04 Jan 2009 17:15:52 GMT

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) :

// WICKET-1280
      		if(mouseactive==1)return false;
      		if(typeof objonchangeoriginal=="function")objonchangeoriginal();

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;
			protected void onComponentTag(ComponentTag 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 :

84// WICKET-1280
85        objonchangeoriginal=obj.onchange; 
86        obj.onchange=function(event){
87      		if(mouseactive==1)return false;
88      		if(typeof
objonchangeoriginal=="function")objonchangeoriginal.apply(this, [event]);
89      	}
90        objonchange=obj.onchange;

all invocation of function need to be change this with new invocation on the
wicket-autocomplete.js file.

View this message in context: http://www.nabble.com/pb-to-access-to-this-on-event-onchange-on-the-AutoCompleteTextField-tp21278638p21278638.html
Sent from the Wicket - User mailing list archive at Nabble.com.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message