wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Dietze ...@fh-wedel.de>
Subject 6.0 Migration issue: wrap Wicket Ajax JS-code as previously with AjaxCallDecorators
Date Thu, 14 Feb 2013 16:54:13 GMT
In the project I'm currently migrating from Wicket 1.4 to 6.6 I have a few pieces
of code where AjaxCallDecorator instances would wrap the Wicket-genrated JS code
as shown in this little example:

| return new AjaxCallDecorator() {
| 
|     @Override
|     public CharSequence decorateScript( final CharSequence script ) {
| 
|       return "var field = findField(); var result = findResult();" //
|               + "if (field.val().length < 3) {" //
|               + "    renderInvisible()" //
|               + "} else {" //
|               + "    $.throttle( getTimeout(), new function() { " + script + " });" //
|               + "}";
|     }
| };

The problem I'm having here is that `$.throttle()' expects the actual script code as
a function, which it then calls according to the set timeout.

To me it seems like this is not possible with the APIs provided by Wicket 6.0, since
I can add code to be executed before and after the Wicket-generated code respecitvely,
but not *around* it. Maybe I haven't fully understood it and there actually is a way
to implement similar functionality?

I am rather unfamiliar with Javascript in general, maybe there's a better and 
easier way to port the above code to Wicket 6.0? 

As always grateful for any hint!

M'bert

-- 
----------- / http://herbert.the-little-red-haired-girl.org / -------------
=+= 
Wer bist du, ungezaehltes Frauenzimmer? Du bist - bist du? - Die Leute sagen, 
du waerest - lass sie sagen, sie wissen nicht, wie der Kirchturm steht. 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message