The zone parameter is easy to use but not very flexible. I wrote a
bind mixin for jQuery that hooks events to pretty much anything. I
suspect you could do the same thing in Prototype. Bind is subclassed
to the event you want to capture so multiple events can be attached to
a single element. Here is an example of a component that hooks a
slider to a select using SlideChange and Change events. The example
also uses the selector binding I wrote.

        <t:any element="div" t:type="any" t:id="slider"
t:mixins="jquery/ui/slider,SlideChange"
                slidechange.event="${event}"
                slidechange.zone="${zone}"
                slidechange.callback="function (event,ui,url) {url.addContext(
${selector:size}.val() )}"
                slider.script='{min:1, max: 5, value: ${selector:size}[ 0 
].selectedIndex + 1,
                        slide: function( event, ui, url ) {
                                ${selector:size}[ 0 ].selectedIndex = ui.value 
- 1;
                        }
                }' >
        </t:any>
        <t:select t:id="size"
                model="literal:GreetingPanel,Small,Medium,Large,Jumbo"
                t:mixins="change"
                change.callback="function(event,ui,url) {
                        ${selector:slider}.slider( 'value',
${selector:this}[0].selectedIndex + 1);
                } "/>

The SlideChange event causes a zone update and the value of the slider
is passed to Tapestry. A change event on the select updates the slider
which in turn causes a SlideChange and zone update. The example above
is certainly more complicated than a simple zone update but I think
the code is pretty readable.

So I would say you need both. A simple zone parameter to do simple
things and a more versatile  event manager when you need more control.

The code for bind is here

https://github.com/trsvax/tapestry5-jquery/blob/master/src/main/java/org/got5/tapestry5/jquery/mixins/Bind.java

Barry

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to