Hi
Try this out . This may surely not be the best way to do it.
Here when u dbl click, the single click event still occurs...but i am using
a variable to detect whether dbl click event happened before or not.
In that case, i simply return after toggling back.
Click Test
WebMarkupContainer click = new WebMarkupContainer("click");
click.setOutputMarkupId(true);
AjaxEventBehavior b1 = new AjaxEventBehavior("onclick"){
@Override
protected void onEvent(AjaxRequestTarget target) {
if(dblclickevent){
dblclickevent = false;
return;
}
target.appendJavascript("alert('onclick
occurred');");
dblclickevent = false;
}
};
b1.setThrottleDelay(Duration.valueOf(1000)); // Make sure
dbl click happens before onclick
click.add(b1);
AjaxEventBehavior b2 = new AjaxEventBehavior("ondblclick"){
@Override
protected void onEvent(AjaxRequestTarget target) {
target.appendJavascript("alert('ondblclick
occurred');");
dblclickevent = true;
}
};
click.add(b2);
add(click);
-swaroop
Federico Fanton wrote:
>
> On Fri, 28 Sep 2007 16:43:05 +0200
> Federico Fanton <[EMAIL PROTECTED]> wrote:
>
>> My problem is that when I double click on the row three events are fired:
>> two onclick and one ondblclick.. Is this normal? Is there a way to
>> isolate the last event and ignore the first two?
>
> I googled some more, and found that usually the workaround is to set a
> timeout for the onclick function, so that if ondblclick gets fired before
> the timeout, it cancels the onclick and goes on about its business.. Is
> there a Wicket behavior that works this way, perhaps? ^__^; I could extend
> AbstractAjaxTimerBehavior maybe..
>
> Many thanks for your time!
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Onclick-and-ondblclick-on-same-element-tf4534962.html#a12975648
Sent from the Wicket - User mailing list archive at Nabble.com.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]