tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barry Books <trs...@gmail.com>
Subject Re: ValueChanged event from RadioGroup and Checkbox
Date Mon, 15 Aug 2011 12:13:48 GMT
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"
		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:select t:id="size"
		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



To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org

View raw message