You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by James Law <jl...@umich.edu> on 2007/10/23 23:50:17 UTC
javascript settimeout on ajaxeventtarget
Hi,
I have a screen that shows a list (using wicket datagrid).
Each row has an href/link that is opening the wicket modal window.
It works well, but the users wanted ability to mouseover (instead of
having to click)
to automatically open the window (without clicking the link).
I accomplished this (thanks wicket!) by doing:
AjaxEventBehavior mouseover = new AjaxEventBehavior("onmouseover"){
Now, the problem arises: the users want to introduce a delay before
handling the mouseover. Using javascript setTimeout seems like the way
to handle this, but what is the correct strategy for getting wicket to
emit this javascript?
eg: setTimeout('wicketfunction', 1000)
or see here for javascript overview:
http://www.w3schools.com/js/js_timing.asp
So my questions are:
1. Does wicket already have me covered and I can't find it?
2. If no, Should I do something similar to what I see in the
Wicket.Throttler code?
3. Any other ideas on best extension approach. (override
AbstractDefaultAjaxBehavior?)
TIA
James
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: javascript settimeout on ajaxeventtarget
Posted by James Law <jl...@umich.edu>.
Matej,
Thanks for your assistance! I put together a blog post on how I went
about it. Critique welcome:
http://jlawmi.blogspot.com/2007/10/modifying-wicket-ajax-javascript-output.html
PS: Next problem. If I have a ModalWindow open, how can I make it close
automatically when the DIV/IFrame that the modalwindow lives in loses
focus.? Users would prefer to not have to use the "X" in the upper
corner of window?
Thanks!
James
Matej Knopp wrote:
> What you want to accomplish needs a little bit more of javascript,
> it's not a simple timeout. Problem is that you need to make sure that
> after the timeout the mouse is still over the element. Anyway, you can
> use AjaxEventBehavior.getAjaxCallDecorator() to return your own
> decorater which decorates the wicket javascript to be invoked only
> when you hold the mouse over the specified element for certain period
> of time (the actual implementation is upon you :) )
>
> -Matej
>
> On 10/23/07, James Law <jl...@umich.edu> wrote:
>
>> Hi,
>>
>> I have a screen that shows a list (using wicket datagrid).
>> Each row has an href/link that is opening the wicket modal window.
>>
>> It works well, but the users wanted ability to mouseover (instead of
>> having to click)
>> to automatically open the window (without clicking the link).
>>
>> I accomplished this (thanks wicket!) by doing:
>>
>> AjaxEventBehavior mouseover = new AjaxEventBehavior("onmouseover"){
>>
>>
>> Now, the problem arises: the users want to introduce a delay before
>> handling the mouseover. Using javascript setTimeout seems like the way
>> to handle this, but what is the correct strategy for getting wicket to
>> emit this javascript?
>>
>> eg: setTimeout('wicketfunction', 1000)
>> or see here for javascript overview:
>> http://www.w3schools.com/js/js_timing.asp
>>
>> So my questions are:
>>
>> 1. Does wicket already have me covered and I can't find it?
>>
>> 2. If no, Should I do something similar to what I see in the
>> Wicket.Throttler code?
>>
>> 3. Any other ideas on best extension approach. (override
>> AbstractDefaultAjaxBehavior?)
>>
>> TIA
>> James
>>
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: javascript settimeout on ajaxeventtarget
Posted by Matej Knopp <ma...@gmail.com>.
What you want to accomplish needs a little bit more of javascript,
it's not a simple timeout. Problem is that you need to make sure that
after the timeout the mouse is still over the element. Anyway, you can
use AjaxEventBehavior.getAjaxCallDecorator() to return your own
decorater which decorates the wicket javascript to be invoked only
when you hold the mouse over the specified element for certain period
of time (the actual implementation is upon you :) )
-Matej
On 10/23/07, James Law <jl...@umich.edu> wrote:
> Hi,
>
> I have a screen that shows a list (using wicket datagrid).
> Each row has an href/link that is opening the wicket modal window.
>
> It works well, but the users wanted ability to mouseover (instead of
> having to click)
> to automatically open the window (without clicking the link).
>
> I accomplished this (thanks wicket!) by doing:
>
> AjaxEventBehavior mouseover = new AjaxEventBehavior("onmouseover"){
>
>
> Now, the problem arises: the users want to introduce a delay before
> handling the mouseover. Using javascript setTimeout seems like the way
> to handle this, but what is the correct strategy for getting wicket to
> emit this javascript?
>
> eg: setTimeout('wicketfunction', 1000)
> or see here for javascript overview:
> http://www.w3schools.com/js/js_timing.asp
>
> So my questions are:
>
> 1. Does wicket already have me covered and I can't find it?
>
> 2. If no, Should I do something similar to what I see in the
> Wicket.Throttler code?
>
> 3. Any other ideas on best extension approach. (override
> AbstractDefaultAjaxBehavior?)
>
> TIA
> James
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org