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


Widget Mixin


Interface for jQuery UI widgets. Generally subclassed to create a specific type of widget. See slider.


Name Required Java Type Default Prefix Default Value Description
optionsfalseJSONObjectliteralnoneArguments used to contruct the widget. Defaults may be supplied thru the WidgetParms service.
scriptfalseStringliteralnoneExperimental! Allows passing javascript functions (or anything) to widgets. This option will contruct a javascript url for the request and use a script tag to fetch it. The gets around JSONObject datatype limitations but adds complications in load balanced/high volume environments.
namefalseStringliteralthis.getClass().getSimpleName().toLowerCase()Name of the jQuery widget. Typically supplied by subclassing widget to a jQuery widget name.

Create a new mixin with just the Widget Class

You can use a jQuery Widget, which is not available as a mixin in your project, by using the Widget class and its name parameter. Tapestry-jQuery will use this value for the name of the widget to execute.
In this example, we want to use the Slider widget (completely different from the Tapestry-jQuery Slider component). The name parameter will be "slider" and Tapestry-jQuery will automatically call the jQuery widget : $(selector).slider(options).

Create a new mixin with a Sub-Class of Widget

You can also create a class, extending the Widget Class, in order to make some initialization for example. You will put this new class in the mixins sub-package. In this case, you do not have to specify the name parameter. By default, Tapestry-jQuery will take the name of the class.