[ 
https://issues.apache.org/jira/browse/TAPESTRY-1524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499930
 ] 

Julian Wood commented on TAPESTRY-1524:
---------------------------------------

An easy work around (changed nameHeader to a component and used targets instead 
of elements):

<div jwcid="[EMAIL PROTECTED]">
    <div jwciid="[EMAIL PROTECTED]">Name<span jwcid="@Insert" 
value="ognl:sortAscending?' ^':' v'"/></div>
</div>

    @InitialValue("ognl:false")
    @Persist
    public abstract Boolean getSortAscending();
    public abstract void setSortAscending(Boolean sortAscending);

    @EventListener(targets = "nameHeader", events = "onclick", async = true)
    public void sort(IRequestCycle cycle)
    {
        setSortAscending(!getSortAscending());
        cycle.getResponseBuilder().updateComponent("myTable");
    } 

> Lose EventListener handling if you update a component containing that 
> EventListener target
> ------------------------------------------------------------------------------------------
>
>                 Key: TAPESTRY-1524
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1524
>             Project: Tapestry
>          Issue Type: Bug
>          Components: XHR/dhtml/Ajax
>    Affects Versions: 4.1.2
>         Environment: java 1.5.0_07, osx 10.4.9, tomcat 5.5.24
>            Reporter: Julian Wood
>            Priority: Minor
>
> It seems that if you update a component inside which there is another 
> component on which there is an EventListener, you will lose that 
> EventListener.
> For example:
> <div jwcid="[EMAIL PROTECTED]">
>     <div id="nameHeader">Name<span jwcid="@Insert" 
> value="ognl:sortAscending?' ^':' v'"/></div>
> </div>
>     @InitialValue("ognl:false")
>     @Persist
>     public abstract Boolean getSortAscending();
>     public abstract void setSortAscending(Boolean sortAscending);
>     @EventListener(elements = "nameHeader", events = "onclick", async = true)
>     public void sort(IRequestCycle cycle)
>     {
>         setSortAscending(!getSortAscending());
>         cycle.getResponseBuilder().updateComponent("myTable");
>     }
> So if you load this up in a browser, then click on 'Name v', it changes to 
> 'Name ^' like it should. But if you click it again, it has lost it's 
> EventListener, and 'Name ^' doesn't change. The ajax response didn't include 
> this bit which creates and connects the event:
> tapestry.cleanConnect(dojo.byId("nameHeader"), "onclick", "event1702620775");
> tapestry.event1702620775=function(e){
> var content={beventname:"onclick"};
> tapestry.event.buildEventProperties(e, content);
> if (!content["beventtarget.id"]) content["beventtarget.id"]="nameHeader";
> tapestry.bind("/myapp/app?component=adminBillableItems&page=Admin&service=directevent&session=T",
>  content);
>  };
> dojo.event.connect(dojo.byId("nameHeader"), "onclick", tapestry, 
> "event1702620775");});

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to