Re: How to call a Wicket Ajax click event

2012-12-06 Thread Jered Myers
I am able to make this work in a Quickstart, so there must be something 
else wrong.  Thanks for the response Martin.


Here is code if anybody wants an example:
Java:
AjaxLink standardAjaxLink = new 
AjaxLink("standardAjaxLink")

{
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target)
{
target.appendJavaScript("alert('The standard ajax link 
has been clicked');");

}
};
standardAjaxLink.setOutputMarkupId(true);
add(standardAjaxLink);

Form form = new Form("pageForm");
add(form);

AjaxSubmitLink ajaxSubmitLink = new 
AjaxSubmitLink("ajaxSubmitLink")

{
private static final long serialVersionUID = 1L;

@Override
public void onSubmit(AjaxRequestTarget target, Form form)
{
target.appendJavaScript("alert('The ajax submit link 
has been subimtted');");

}
};
form.add(ajaxSubmitLink);

HTML:

function clickTheAjaxLink() {
$("a[linkType=standard]").triggerHandler("click");
}
function clickTheAjaxSubmitLink() {
$("a[linkType=submit]").triggerHandler("click");
}

Click the Ajax 
Link Standard 
Ajax Link


Click the 
Ajax Submit Link



Submit 
Form



On 12/06/2012 12:16 AM, Martin Grigorov wrote:

Hi,

Wicket 6 uses jQuery.on() to register the event listeners.
If your AjaxSubmitLink listens on 'click' then
jQuery('#theSubmitLinkId').triggerHandler('click') should do it.
Also check the docs of jQuery#trigger


On Thu, Dec 6, 2012 at 1:53 AM, Jered Myers wrote:


The link here is actually an AjaxSubmitLink and not an AjaxLink.  I am
trying to get back to the onSubmit on the server side.  I saw
http://apache-wicket.1842946.**n4.nabble.com/Wicket-6-Ajax-**
Behaviors-td4654398.html,
but $(mylink).triggerHandler('**click') doesn't seem to be working. Do I
treat the trigger on an AjaxSubmitLink different from a regular AjaxLink?


On 12/05/2012 03:28 PM, Jered Myers wrote:


Wicket 6.3

How do I call a click event on an AjaxLink from via jQuery or JavaScript?
  I have an AjaxLink that I have added to the page and after I run some
JavaScript, I want to pragmatically click the link with JavaScript.  This
broke when updating from Wicket 1.5 to 6.  It appears that the onclick
attribute is no longer on my link and I am not sure how to call the events
that Wicket has registered in the head.







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



Re: How to call a Wicket Ajax click event

2012-12-06 Thread Martin Grigorov
Hi,

Wicket 6 uses jQuery.on() to register the event listeners.
If your AjaxSubmitLink listens on 'click' then
jQuery('#theSubmitLinkId').triggerHandler('click') should do it.
Also check the docs of jQuery#trigger


On Thu, Dec 6, 2012 at 1:53 AM, Jered Myers wrote:

> The link here is actually an AjaxSubmitLink and not an AjaxLink.  I am
> trying to get back to the onSubmit on the server side.  I saw
> http://apache-wicket.1842946.**n4.nabble.com/Wicket-6-Ajax-**
> Behaviors-td4654398.html,
> but $(mylink).triggerHandler('**click') doesn't seem to be working. Do I
> treat the trigger on an AjaxSubmitLink different from a regular AjaxLink?
>
>
> On 12/05/2012 03:28 PM, Jered Myers wrote:
>
>> Wicket 6.3
>>
>> How do I call a click event on an AjaxLink from via jQuery or JavaScript?
>>  I have an AjaxLink that I have added to the page and after I run some
>> JavaScript, I want to pragmatically click the link with JavaScript.  This
>> broke when updating from Wicket 1.5 to 6.  It appears that the onclick
>> attribute is no longer on my link and I am not sure how to call the events
>> that Wicket has registered in the head.
>>
>>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com 


Re: How to call a Wicket Ajax click event

2012-12-05 Thread Jered Myers
The link here is actually an AjaxSubmitLink and not an AjaxLink.  I am 
trying to get back to the onSubmit on the server side.  I saw 
http://apache-wicket.1842946.n4.nabble.com/Wicket-6-Ajax-Behaviors-td4654398.html, 
but $(mylink).triggerHandler('click') doesn't seem to be working. Do I 
treat the trigger on an AjaxSubmitLink different from a regular AjaxLink?


On 12/05/2012 03:28 PM, Jered Myers wrote:

Wicket 6.3

How do I call a click event on an AjaxLink from via jQuery or 
JavaScript?  I have an AjaxLink that I have added to the page and 
after I run some JavaScript, I want to pragmatically click the link 
with JavaScript.  This broke when updating from Wicket 1.5 to 6.  It 
appears that the onclick attribute is no longer on my link and I am 
not sure how to call the events that Wicket has registered in the head.






How to call a Wicket Ajax click event

2012-12-05 Thread Jered Myers

Wicket 6.3

How do I call a click event on an AjaxLink from via jQuery or 
JavaScript?  I have an AjaxLink that I have added to the page and after 
I run some JavaScript, I want to pragmatically click the link with 
JavaScript.  This broke when updating from Wicket 1.5 to 6.  It appears 
that the onclick attribute is no longer on my link and I am not sure how 
to call the events that Wicket has registered in the head.


--
Jered Myers


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