You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by kenixwong <ke...@yahoo.com> on 2008/01/30 06:47:09 UTC
can auto fire the ajaxLink onClick function without click on the
link?
Hi
i wish once the page is load, it will auto pop up the modal window. From the
wicket example, the modal window will only display once the user click on
the ajaxLink. So, is there any solution to auto fire the onClick function
without click the ajax Link.?
my page constructor involved the modal window and the ajaxLink:
final ModalWindow cancelModal = new ModalWindow("cancelModal ");
cancelModal .setPageMapName("cancelModal ");
cancelModal .setCookieName("cancelModal ");
cancelModal .setResizable(false);
cancelModal setInitialWidth(30);
cancelModal .setInitialHeight(12);
cancelModal .setWidthUnit("em");
cancelModal .setHeightUnit("em");
cancelModal .setPageCreator(new ModalWindow.PageCreator()
{
public Page createPage()
{
return new
CancelModal Page(CurrentPage.this);
}
});
add(cancelModal );
cancelModal .setOutputMarkupId(true);
add(link = new AjaxLink("cancelReportModalLink")
{
public void onClick(AjaxRequestTarget target)
{
triggerTarget = target;
cancelReportModal.show(target);
}
});
// is there i wrote in this way, the onClick function will fire once
the page is load
link.onClick(triggerTarget);
can anyone give help ? or any idea on it...
thanks in advance
--
View this message in context: http://www.nabble.com/can-auto-fire-the-ajaxLink-onClick-function-without-click-on-the-link--tp15175973p15175973.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: can auto fire the ajaxLink onClick function without click on
the link?
Posted by kenixwong <ke...@yahoo.com>.
thanks for reply , Matthijs
i get it. but apply in the modal window instead of ajaxLink here
cancelReportModal.add(new AbstractAjaxTimerBehavior(Duration.seconds(1))
{ // pop out every second @Override
protected void onTimer(AjaxRequestTarget target) {
cancelReportModal.show(target);
}
});
but if i just want it to show one time. How i stop it? from the code above,
it will call every 1 second.
Another question here. In my page constructor, i defined the component
modalWindow, feedbackPanel, a form in sequence. So, in common sense, it will
call the modalWindow ( i wish to auto pop up once the page is load ) first
follow by the other. The problem i faced here is the modal window run at the
end once the page is finish loaded. Is that the wicket had per-defined a
Thread for the form component once the page constructor is called ? Can
anyone give me more details on it?
i want the modal window load once the page is run. The main purpose for the
modal window is feasible the user whether want to cancel the page loading or
continue.
Thanks in advance
Matthijs Wensveen-2 wrote:
>
> kenixwong wrote:
>> Hi
>>
>> i wish once the page is load, it will auto pop up the modal window. From
>> the
>> wicket example, the modal window will only display once the user click on
>> the ajaxLink. So, is there any solution to auto fire the onClick function
>> without click the ajax Link.?
>>
>> my page constructor involved the modal window and the ajaxLink:
>>
>> final ModalWindow cancelModal = new ModalWindow("cancelModal ");
>> cancelModal .setPageMapName("cancelModal ");
>> cancelModal .setCookieName("cancelModal ");
>> cancelModal .setResizable(false);
>> cancelModal setInitialWidth(30);
>> cancelModal .setInitialHeight(12);
>> cancelModal .setWidthUnit("em");
>> cancelModal .setHeightUnit("em");
>>
>>
>> cancelModal .setPageCreator(new ModalWindow.PageCreator()
>> {
>> public Page createPage()
>> {
>> return new
>> CancelModal Page(CurrentPage.this);
>> }
>> });
>> add(cancelModal );
>> cancelModal .setOutputMarkupId(true);
>>
>> add(link = new AjaxLink("cancelReportModalLink")
>> {
>> public void onClick(AjaxRequestTarget target)
>> {
>> triggerTarget = target;
>> cancelReportModal.show(target);
>> }
>> });
>>
>> // is there i wrote in this way, the onClick function will fire
>> once
>> the page is load
>> link.onClick(triggerTarget);
>>
>>
>> can anyone give help ? or any idea on it...
>>
>>
>> thanks in advance
>>
>>
>>
> You only need an AjaxRequestTarget, not necessarily from onClick. You
> might add an AbstractAjaxTimerBehavior to cancelReportModal and then in
> onTimer(ART t) { target.add(cRM); cRM.show(t); this.stop(); /* you only
> want this once */ }
>
> Or something alike (if it doesn't work, maybe add the behavior to the
> container or something)
>
> Matthijs
>
> --
> Matthijs Wensveen
> Func. Internet Integration
> W http://www.func.nl
> T +31 20 4230000
> F +31 20 4223500
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/can-auto-fire-the-ajaxLink-onClick-function-without-click-on-the-link--tp15175973p15197512.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: can auto fire the ajaxLink onClick function without click on
the link?
Posted by Matthijs Wensveen <m....@func.nl>.
kenixwong wrote:
> Hi
>
> i wish once the page is load, it will auto pop up the modal window. From the
> wicket example, the modal window will only display once the user click on
> the ajaxLink. So, is there any solution to auto fire the onClick function
> without click the ajax Link.?
>
> my page constructor involved the modal window and the ajaxLink:
>
> final ModalWindow cancelModal = new ModalWindow("cancelModal ");
> cancelModal .setPageMapName("cancelModal ");
> cancelModal .setCookieName("cancelModal ");
> cancelModal .setResizable(false);
> cancelModal setInitialWidth(30);
> cancelModal .setInitialHeight(12);
> cancelModal .setWidthUnit("em");
> cancelModal .setHeightUnit("em");
>
>
> cancelModal .setPageCreator(new ModalWindow.PageCreator()
> {
> public Page createPage()
> {
> return new
> CancelModal Page(CurrentPage.this);
> }
> });
> add(cancelModal );
> cancelModal .setOutputMarkupId(true);
>
> add(link = new AjaxLink("cancelReportModalLink")
> {
> public void onClick(AjaxRequestTarget target)
> {
> triggerTarget = target;
> cancelReportModal.show(target);
> }
> });
>
> // is there i wrote in this way, the onClick function will fire once
> the page is load
> link.onClick(triggerTarget);
>
>
> can anyone give help ? or any idea on it...
>
>
> thanks in advance
>
>
>
You only need an AjaxRequestTarget, not necessarily from onClick. You
might add an AbstractAjaxTimerBehavior to cancelReportModal and then in
onTimer(ART t) { target.add(cRM); cRM.show(t); this.stop(); /* you only
want this once */ }
Or something alike (if it doesn't work, maybe add the behavior to the
container or something)
Matthijs
--
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org