[ http://issues.apache.org/jira/browse/TAPESTRY-1132?page=all ]

Jesse Kuhnert updated TAPESTRY-1132:
------------------------------------

    Fix Version/s: 4.1.2

> EventListeners can not be wired up programatically ( needed to handle For 
> loops)
> --------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-1132
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-1132
>             Project: Tapestry
>          Issue Type: Improvement
>            Reporter: Patrick Moore
>             Fix For: 4.1.2
>
>
> What I am hoping to do is something like this:
> <span jwcid="@For" value="ognl:current">
>     <a jwcid="foo"><span jwcid="@Insert" value="ognl:current"/></a>
>     <span jwcid="@InvokeListener" listener="listener:makeLink"/>
> </span>
> and code like this:
>   public void makeLink() {
>       IEventListener listener = getFoo().getEventListener("onclick");
>       listener.setEventHandler("bar");
>       listener.setParameters(new Object[]{ getCurrent().getEntityId()});
>   }
>   // called when user clicks on one of the generated links in @For
>   public void bar(Long entityId) {
>      System.out.println("link for "+ entityId +"was clicked!");
>   }
> Hope that helps...
> CD suggested this:
> I found a nice solution using dojo's ability to listen to an arbitrary
> javascript function as if it were a native event.
> I attach an empty js function to an arbitrary DOM element like this:
> document.getElementById('someDiv').clickRadio=function(radio) {};
> and an onclick attribute to my radio buttons:
> <span jwcid="@Radio" value="ognl:lv.value" onclick="document.getElementById
> ('someDiv').clickRadio(this);"/>
> Then I can set an EventListener on the server-side
>    @EventListener(targets = "someDiv", events = "clickRadio", submitForm =
> "form")
>    public void listenToOnclickOnAnyRadioButtonInTheForLoop(IRequestCycle
> cycle) throws InterruptedException {
>        ...
>    }
> Works fine.
> Ch.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to