Sounds like a bug, if you would file it that would help me.
To get past your problem though, you may want to try changing your html element to be: <div id="[EMAIL PROTECTED]">Name .......</div> and listener : @EventListener(targets = "nameHeader", events = "onclick") public void doSomething(){} I'm assuming the bug has to do with targeting elements specifically instead of components. On 5/29/07, Julian Wood <[EMAIL PROTECTED]> wrote:
The eventlistener is amazing and opens up all sorts of neat possibilities. For instance it becomes quite simple to roll your own ajax-enabled table component, with all the flexibility gained by building it from the ground up, but with almost all of the complexities removed. To that end, I have one little problem with EventListener, which I think is a bug, but maybe I'm doing something different than intended. 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. 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");}); I suppose I could just do it myself, but shouldn't that bit of js just be included in the async response? Thanks, J -- Julian Wood <[EMAIL PROTECTED]> Software Engineer Teaching & Learning Centre University of Calgary http://tlc.ucalgary.ca
-- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com