On Feb 18, 2009, at 02:33 PM, Henrique Prange wrote:

Simple question: Is there a simple/correct way to call subcomponent actions? How can I do that?

Here is an example why I need that. I have the following structure in one of my components:

<wo:AjaxModalDialog onClose = "$clearState">
  <wo:WOSwitchComponent WOComponentName = "$componentName">
</wo:AjaxModalDialog>

I need to clear the state of the component instantiated by WOSwitchComponent, but I don't know how to call the action within the 'clearState' method on the current component.

I see it is straightforward to access the component hierarchy in a bottom-up manner (call a parent action, push and pull values from parent), but I haven't found a corresponding way to do that top-down.

Maybe I'm over complicating the problem, but I haven't found an efficient way to do this.


Just a thought, but you might try posting a notification from your clearState() method in the parent component, using the parent as the notification object. Then in your switched component you can listen for that notification from the parent object and handle appropriately.

Obviously, you'd have to handle registration appropriately in the child component so that you have access to the parent component when registering for the notification--I'm thinking maybe during awake() or during appendToResponse(), and then unregistering during sleep()? Either that, or just register for the notification blindly and check the notification object before clearing the state.

Fez


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to