You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by George Christman <gc...@cardaddy.com> on 2011/07/18 15:16:10 UTC
Tapestry Zone and jquery
Hello all, I'm using some jquery to handle some of my UI elements which works
perfectly until I add a tapestry zone to the mix. When a zone is reloaded,
the jquery javascript no longer applies the styles to the elements. I see
jquery offers live which is good for key down and clicks etc, but would
require an action from the user once the zone has been reloaded rather than
automatically applied. Any suggestions?
jquery live url.
http://api.jquery.com/live/
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-Zone-and-jquery-tp4599457p4599457.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry Zone and jquery
Posted by George Christman <gc...@cardaddy.com>.
I figured out how to use it, just as simple as you said, only thing left to
figure out is how to call a jquery function from my class. I'm using
afterRender.
void afterRender() {
javasScriptSupport.addScript(
"$('%s').observe(Tapestry.ZONE_UPDATED_EVENT, function() { "
// + "alert('works');"
+ "$('zoneUpdater')"
+ "});",
shiptoZone.getClientId());
}
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-Zone-and-jquery-tp4599457p4600289.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry Zone and jquery
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 18 Jul 2011 12:35:23 -0300, George Christman
<gc...@cardaddy.com> wrote:
> Is there any good doc on how to use the Tapestry.ZONE_UPDATE_EVENT ? I
> don't completely understand it just yet.
It's quite simple: it's the name of the event tiggered the HTML element
generated by the Zone component when a zone has just been updated from an
AJAX request.
> I'm aware of the css approach, however I was under the understanding it
> wouldn't function in older browsers.
Older browsers = Internet Explorer. Firefox, Opera and Safari has been
supporting it for many years.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry Zone and jquery
Posted by George Christman <gc...@cardaddy.com>.
Is there any good doc on how to use the Tapestry.ZONE_UPDATE_EVENT ? I don't
completely understand it just yet.
I'm aware of the css approach, however I was under the understanding it
wouldn't function in older browsers.
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-Zone-and-jquery-tp4599457p4600041.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry Zone and jquery
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 18 Jul 2011 11:29:10 -0300, George Christman
<gc...@cardaddy.com> wrote:
> jQuery(document).ready(function($) {
> $('label.req').prepend('* ');
> $('label').append(':');
> }
The ready() event (which is just the dom:loaded event) is only triggered
by the browser JavaScript DOM when a full page render is done, so Tapestry
is working as it should here. Tapestry zones trigger the
Tapestry.ZONE_UPDATED_EVENT event, so you can run whatever you want when a
zone is updated.
By the way, you replace the code above with CSS with :before and :after.
See example here: http://www.w3schools.com/cssref/sel_after.asp.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry Zone and jquery
Posted by George Christman <gc...@cardaddy.com>.
This is one example, however the problem is much more common when using
jQuery UI with tapestry zones. The zone works perfectly, jquery doesn't seem
to be firing on zone reloads, only when the entire page is reloaded.
<t:select t:id="location" value="purchaseRequest.ifasShipto"
model="ifasShiptoModel" zone="shiptoZone" blankLabel="Ship to Location"/>
<t:Zone t:id="shiptoZone" update="show">
<div>
<t:Label for="address_1" class="req"/>
<t:TextField t:id="address_1"
value="purchaseRequest.ifasShipto.address_1"/>
</div>
</t:Zone>
Object onValueChangedFromLocation(IfasShipto ifasShipto) {
getPurchaseRequest().setIfasShipto(ifasShipto);
return shiptoZone.getBody();
}
js.
jQuery.noConflict();
jQuery(document).ready(function($) {
$('label.req').prepend('* ');
$('label').append(':');
}
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-Zone-and-jquery-tp4599457p4599771.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tapestry Zone and jquery
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 18 Jul 2011 10:16:10 -0300, George Christman
<gc...@cardaddy.com> wrote:
> Hello all, I'm using some jquery to handle some of my UI elements which
> works perfectly until I add a tapestry zone to the mix. When a zone is
> reloaded, the jquery javascript no longer applies the styles to the
> elements. I see
> jquery offers live which is good for key down and clicks etc, but would
> require an action from the user once the zone has been reloaded rather
> than automatically applied. Any suggestions?
Code and template please. And return zone.getBody() instead of the zone
itself when returning from an AJAX event handler method.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org