Hi Martin,
it's possible to set an throtteling delay by Wicket
AjaxRequestAttributes. Have a look at
https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax#WicketAjax-AjaxRequestAttributes
Something like this:
new AjaxEventBehavior("onkeydown"){
void updateAjaxAttributes(AjaxRequestAttributes attr)
{
attributes.setThrottlingSettings(new ThrottlingSettings(id,
delay))
}
}
Greets Fred
Am 14.02.2013 17:54, schrieb Martin Dietze:
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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org