running JS to attach client events to a zones content after it's rendered

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

running JS to attach client events to a zones content after it's rendered

Qbyte Consulting
Hi,

I have a zone with some conditional content so it doesn't appear when the
page is initially loaded but is added later when the zone is rerendered
with a flag set true.

There is a button in the zone that I need to attach jquery events handling
functions too from a module. How do I fire the module function each after
any time the zone is rendered?

John
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: running JS to attach client events to a zones content after it's rendered

Chris Poulsen
You can bind the button listener on an enclosing element ( document for
example ) or you can bind on one of the zone update events and wire up
things from there (I think i found some tapestry js components that uses a
function called "scan" or "scanner" to initialize dynamically loaded stuff
- there are helpers for the "scanner pattern" in t5/core/dom iirc.

I tend to prefer binding the handlers on the document whenever possible.

--
Chris

On Sat, Oct 1, 2016 at 7:58 PM, Qbyte Consulting <[hidden email]>
wrote:

> Hi,
>
> I have a zone with some conditional content so it doesn't appear when the
> page is initially loaded but is added later when the zone is rerendered
> with a flag set true.
>
> There is a button in the zone that I need to attach jquery events handling
> functions too from a module. How do I fire the module function each after
> any time the zone is rendered?
>
> John
>
Loading...