page.add(new AjaxEventBehavior("my-special-event") {...});
in JS code: jQuery(document).triggerHandler('my-special-event');
Voila!
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Fri, Jul 11, 2014 at 10:15 AM, Sven Meier <[email protected]> wrote:
> an AjaxEventBehavior, but I don't have a component to attach it to.
>>
>
> You have a page, don't you?
> Otherwise you can request a resource via Ajax too.
>
> Regards
> Sven
>
>
>
>
> On 07/11/2014 02:47 AM, Joachim Schrod wrote:
>
>> Hi,
>>
>> In a Wicket application I have JQuery code that triggers after a
>> certain time of user inactivity. I need to tell server-side about
>> that inactivity. No problem, I thought, just issue an AJAX request.
>>
>> Well, looking around I found several possibilities to do that as a
>> side effect, but no component at first hand that is made up for
>> that task. I thought that's strange, it doesn't sound as a remote
>> demand. So my question is about best practice for this use case.
>>
>> Namely: I have a change on client-side that I want to communicate
>> to server-side. No changes in DOM are associated. Just like
>> triggering an AjaxLink where onClick() does not call any methods on
>> target. I know about the JavaScript function Wicket.Ajax.ajax() and
>> its arguments. My problem is choosing the right component server-side.
>>
>> An AjaxEventBehavior would be the right thing, but I don't have a
>> component to attach it to. The worst solution would be a hidden
>> AjaxLink. IMO I simply need to establish a listener URL that
>> triggers some method, an URL that I can use in a Wicket.Ajax.ajax()
>> call -- but I don't find the Wicket component that supplies me with
>> that functionality.
>>
>> How can I do that?
>> Or is my focus on the Wicket.Ajax.ajax() JS interface blocking my
>> view on another solution that's better?
>>
>> I know my way around Wicket's code and documentation. Thus, a hint
>> like "start with class XYZ" would be very much appreciated, I don't
>> need a full solution with code. I'm surely missing something
>> obvious and would severely appreciate any help or tips.
>>
>> Cheers,
>> Joachim
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>