Tapestry5 jQuery provides jQuery Components and can fully replace Prototype and Scriptaculous by jQuery


Bind Mixin


This mixin used jQuery bind to connect java/javascript objects to jQuery events. Bind is easily subclassed to allow more than one event per element.


Name Required Java Type Default Prefix Default Value Description
elementfalseStringliteralgetClientId()Used as the selector for jQuery bind.
contextfalseObject[]propnoneThe context used to construct the event link.
titlefalseStringliteralnoneWhen an event is triggered the page title is changed to this value.
historyfalseStringliteralnoneJavascript anonymous function called by the event. Used to manage history on the browser. Signature is history(event,ui,url). The parameter types are identical to callback.
eventTypefalseStringliteralthis.getClass().getSimpleName().toLowerCase()Name of the jQuery event. By subclassing bind you can create mixins named by the jQuery event type. This allows more than one event per element.
preventDefaultfalseBooleanproptrueIf true calls event.preventDefault().
doImportsfalseBooleanproptrueIf true bind will attempt to include the right effect libraries for zone and hide.
contextMarkerfalseStringliteralCoNtExTUsed as a marker by url.addContext() to insert values into the Tapestry event url.
eventfalseStringliteralnoneTapestry event name. For example if you supply click onClick() will be called.
hidefalseStringliteralnoneID of element to hide on this event.
hideEffectfalseStringliteralslidejQuery effect used to hide the element.
hideTimefalseStringliteral500Duration of hide effect.
hideOptionfalseMap<String, String>propnoneAny options need by the hide effect.
zonefalseStringliteralnoneIf supplied a zone update will be triggered.
zoneUpdatefalseStringliteralhighlightEffect used when zone is updating.
callbackfalseStringliteralnoneJavascript anonymous function called by the event. The signature is function(event,ui,url) where event and ui are described by jQuery bind. The url parameter is structure representing the Tapestry event url and contains the url and a function to add a context. See examples below.

How to Bind just a JavaScript event ?

With the Bind mixin, we can catch JavaScript events in your Java Class. Tapestry-jQuery will trigger an Ajax Request. In this example, I will bind the slidechange event of the slider widget

Zone for the SlideChange event :