You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Zheng, Xiahong" <Xi...@FMR.COM> on 2008/03/18 15:00:52 UTC

onClick() called after model is loaded

Is onClick() called during the process of page rendering? My page has
some components with visibility controlled by model attributes. If the
model is loaded before the onClick() method is called, the page will not
render correctly unless I force a reload again to reflect the state
change made by onClick() method. Is it a way to get onClick called
before the page rendering? I also notice the addStateChange method, but
now sure how to use it. Can someone help? Thanks. -XZ

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


Re: onClick() called after model is loaded

Posted by Igor Vaynberg <ig...@gmail.com>.
visibility of components is checked before onclick for security
reasons - eg you should not be able to click a link that is not
visible. if you use your model inside isvisible() override it will
potentially get loaded with stale data, you have two options:

1) instead of overriding isvisible() override onbeforerender() and
call setvisible()
2) as the last thing you do in onclick() call detach() on the
component that has isvisible() overridden

-igor


On Tue, Mar 18, 2008 at 7:00 AM, Zheng, Xiahong <Xi...@fmr.com> wrote:
> Is onClick() called during the process of page rendering? My page has
>  some components with visibility controlled by model attributes. If the
>  model is loaded before the onClick() method is called, the page will not
>  render correctly unless I force a reload again to reflect the state
>  change made by onClick() method. Is it a way to get onClick called
>  before the page rendering? I also notice the addStateChange method, but
>  now sure how to use it. Can someone help? Thanks. -XZ
>
>  ---------------------------------------------------------------------
>  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