Hi Everyone,

This may be simple, but I can't seem to figure it out.

A page will initialize on an action request with the onActivate() method.
But I can't figure out how to get a component to initialize on an action
request. I know we can use @SetupRender, etc, but this is no good for an
Ajax response from an embedded component because @SetupRender is never
called...

To illustrate initially I had

Page -> Subcomponent

Where the subcomponent is used to return an ajax response. All
initialization is done in the page and then parameters bound to the
component. I have not used any @Persist

I then split it up to

Page -> Component -> SubComponent

Where initialization needs to be done in the component (The page is very
simple). Because onActivate() doesn't work in the component, I simply used
onActivate() to populate some properties, then bound those to the component.
Just a simple way of passing the activation context to the component. Hope
this makes sense.

So the component needs to fetch some data from the database to initialise,
which it does when @SetupRender is called.

The issue now comes on the action request to the subcomponent, because
@SetupRender has not been called. The onActivate() has been called in the
page and the parameters passed to the component. But the component needs to
initialise and populate some extra fields (which are then passed to the
subcomponent to render the ajax response). Even without the ajax it wouldn't
matter, because if my event handler is accessing database data, it won't be
initialised yet...

I'm sure there has got to be a simple way around this other than injecting
the component into either the page or the subcomponent and then calling an
initialize method on onActivate() (from the page) or onAction() from the
subcomponent. Is there like an initialize annotation I can use? Using the
event bubbling is no good because the subcomponent event handler is fired
first before the component event handler.

-- 
View this message in context: 
http://www.nabble.com/Component-equivalent-of-Page-onActivate%28%29-tp22865238p22865238.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to