You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by MattyDE <uf...@gmail.com> on 2010/04/20 08:31:21 UTC

Any indicator for Ajax-Rendering?

Hi Folks,

is there any indicator in onAfterRender() or onBeforeRender() inside a
Component which tells me that this Component is now rendered (updated)
through ajax (AjaxTarget.addComponent()), instead of the "normal"
page-rendering?

I need to know this, because i want to update an DropDownChoice by another
DropDownChoice with "on change" handler. But if this second DropDownChoice
has been updated, i want to update some other TextFields too... and the only
"indicator" i have is, that the second DDC has been re-rendered....

Thanks for any Hints ;)
-- 
View this message in context: http://n4.nabble.com/Any-indicator-for-Ajax-Rendering-tp2016955p2016955.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: Any indicator for Ajax-Rendering?

Posted by MattyDE <uf...@gmail.com>.
Yeah you're right... but i think i have to describe my problem i another way.

I have two linked DropDownBoxes and i want intially on Page-Rendering that
the second (child) drop downbox is filled by the initial value of the first
box.

the linking is done with my own "onChange" handler

protected void onChange(AjaxRequestTarget target, T newSelection){ };

the best would be, i could use this  handler for initial rendering and
ajax-onChange, cause there i've implemented the processing of filling the
second drop down box By "newSelection"!

Thanks for any Hints!
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Any-indicator-for-Ajax-Rendering-tp2016955p2075498.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: Any indicator for Ajax-Rendering?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Then it should come from an AJAX request as the code above shows...??

Ernesto

On Tue, Apr 20, 2010 at 10:00 AM, MattyDE <uf...@gmail.com> wrote:

>
> I know. But i breakpointed there... and AjaxRequestTarget.get() is not null
> in onBeforeRender
> --
> View this message in context:
> http://n4.nabble.com/Any-indicator-for-Ajax-Rendering-tp2016955p2017047.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: Any indicator for Ajax-Rendering?

Posted by MattyDE <uf...@gmail.com>.
I know. But i breakpointed there... and AjaxRequestTarget.get() is not null
in onBeforeRender
-- 
View this message in context: http://n4.nabble.com/Any-indicator-for-Ajax-Rendering-tp2016955p2017047.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: Any indicator for Ajax-Rendering?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
That's really weird because the code of get is like

public static AjaxRequestTarget get()
    {
        final RequestCycle requestCycle = RequestCycle.get();
        if (requestCycle != null)
        {
            if (requestCycle.getRequestTarget() instanceof
AjaxRequestTarget)
            {
                return (AjaxRequestTarget)requestCycle.getRequestTarget();
            }
        }
        return null;
    }

Best,

Ernesto

On Tue, Apr 20, 2010 at 9:32 AM, MattyDE <uf...@gmail.com> wrote:

>
> I thought the same.. but... its not true ;) .. it returns not null
> --
> View this message in context:
> http://n4.nabble.com/Any-indicator-for-Ajax-Rendering-tp2016955p2017020.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: Any indicator for Ajax-Rendering?

Posted by MattyDE <uf...@gmail.com>.
I thought the same.. but... its not true ;) .. it returns not null
-- 
View this message in context: http://n4.nabble.com/Any-indicator-for-Ajax-Rendering-tp2016955p2017020.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: Any indicator for Ajax-Rendering?

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Not 100% sure but I think AjaxRequestTarget.get() will return null if
request is not AJAX. Maybe you could use that as a "flag".

Best,

Ernesto

On Tue, Apr 20, 2010 at 8:31 AM, MattyDE <uf...@gmail.com> wrote:

>
> Hi Folks,
>
> is there any indicator in onAfterRender() or onBeforeRender() inside a
> Component which tells me that this Component is now rendered (updated)
> through ajax (AjaxTarget.addComponent()), instead of the "normal"
> page-rendering?
>
> I need to know this, because i want to update an DropDownChoice by another
> DropDownChoice with "on change" handler. But if this second DropDownChoice
> has been updated, i want to update some other TextFields too... and the
> only
> "indicator" i have is, that the second DDC has been re-rendered....
>
> Thanks for any Hints ;)
> --
> View this message in context:
> http://n4.nabble.com/Any-indicator-for-Ajax-Rendering-tp2016955p2016955.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
>
>