I've never done this, but it's such a nice brain-teaser I had to try :). And 
what I did _seems_ to work.

https://gist.github.com/hugithordarson/37d03336de17cfcf3ac399f6325e0ff2

The key is making the child component non-synchronizing, otherwise the parent 
action will get invoked during the pulling of binding values. And it should be 
quite OK if the action method returns null, that just means the same as 
returning null from any action invocation, i.e. "I'm working within and 
returning the current page instance".

I'm thinking… It kind of feels like one would have to setCurrentComponent( 
parent() ) in the child before performing the action invocation and then reset 
it back to itself afterwards (since we're really invoking an action within the 
context of the parent component), but I might be wrong, this seems to work 
without it.

Cheers,
- hugi



> On Apr 26, 2024, at 19:47, ocs--- via Webobjects-dev 
> <webobjects-dev@lists.apple.com> wrote:
> 
> Hi there,
> 
> I've got a sub-component which uses performParentAction; the appropriate 
> binding is something like <wo:MySubcomponent actionName="foo"/>. Works 
> perfectly.
> 
> Purely for aesthetic reasons (and, well, for consistency), I would prefer if 
> I could use the sub-component precisely same way one uses wo:hyperlink, i.e., 
> like this: <wo:MyCubcomponent action="$foo"/>
> 
> Is there a trick to achieve that? Looks like in this case when I try 
> valueForBinding('action'), I get NULL :(
> 
> Thanks,
> OC
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmenn.is
> 
> This email sent to h...@karlmenn.is

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

This email sent to arch...@mail-archive.com

Reply via email to