org.codehaus.groovy.grails.plugins.web.taglib
[Groovy] Class JavascriptTagLib
java.lang.Object
org.codehaus.groovy.grails.plugins.web.taglib.JavascriptTagLib
class JavascriptTagLib
Tags for developing javascript and ajax applications.
- Authors:
- Graeme Rocher
Property Summary |
static java.lang.Object |
CONTROLLER
|
static java.lang.Object |
INCLUDED_JS
|
static java.lang.Object |
INCLUDED_LIBRARIES
Mappings to the relevant files to be included for each library.
|
static java.lang.Object |
LIBRARY_MAPPINGS
|
static java.lang.Object |
PROVIDER_MAPPINGS
|
java.lang.Object |
escapeJavascript
Escapes a javascript string replacing single/double quotes and new lines.
|
java.lang.Object |
formRemote
A form which used prototype to serialize its parameters and submit via an asynchronous ajax call.
|
java.lang.Object |
javascript
Includes a javascript src file, library or inline script
if the tag has no 'src' or 'library' attributes its assumed to be an inline script:
|
GrailsPluginManager |
pluginManager
|
java.lang.Object |
remoteField
A field that sends its value to a remote link.
|
java.lang.Object |
remoteFunction
Creates a remote function call using the prototype library.
|
java.lang.Object |
remoteLink
A link to a remote uri that used the prototype library to invoke the link via ajax.
|
java.lang.Object |
setProvider
|
java.lang.Object |
submitToRemote
Creates a form submit button that submits the current form to a remote ajax call.
|
Methods inherited from class java.lang.Object
|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
CONTROLLER
static final java.lang.Object CONTROLLER
-
INCLUDED_JS
static final java.lang.Object INCLUDED_JS
-
INCLUDED_LIBRARIES
static final java.lang.Object INCLUDED_LIBRARIES
- Mappings to the relevant files to be included for each library.
LIBRARY_MAPPINGS
static final java.lang.Object LIBRARY_MAPPINGS
-
PROVIDER_MAPPINGS
static final java.lang.Object PROVIDER_MAPPINGS
-
escapeJavascript
java.lang.Object escapeJavascript
- Escapes a javascript string replacing single/double quotes and new lines.
<g:escapeJavascript>This is some "text" to be escaped</g:escapeJavascript>
formRemote
java.lang.Object formRemote
- A form which used prototype to serialize its parameters and submit via an asynchronous ajax call.
- attr:
- name REQUIRED The form name
- attr:
- url REQUIRED The url to submit to as either a map (containing values for the controller, action, id, and params) or a URL string
- attr:
- action The action to execute as a fallback, defaults to the url if non specified
- attr:
- update Either a map containing the elements to update for 'success' or 'failure' states, or a string with the element to update in which cause failure events would be ignored
- attr:
- before The javascript function to call before the remote function call
- attr:
- after The javascript function to call after the remote function call
- attr:
- asynchronous Whether to do the call asynchronously or not (defaults to true)
- attr:
- method The method to use the execute the call (defaults to "post")
javascript
java.lang.Object javascript
- Includes a javascript src file, library or inline script
if the tag has no 'src' or 'library' attributes its assumed to be an inline script:
<g:javascript>alert('hello')</g:javascript>
The 'library' attribute will attempt to use the library mappings defined above to import the
right js files and not duplicate imports eg.
<g:javascript library="scripaculous" /> // imports all the necessary js for the scriptaculous library
The 'src' attribute will merely import the js file but within the right context (ie inside the /js/ directory of
the Grails application:
<g:javascript src="myscript.js" /> // actually imports '/app/js/myscript.js'- attr:
- src The name of the javascript file to import. Will look in web-app/js dir
- attr:
- library The name of the library to include. Either "prototype", "scriptaculous", "yahoo" or "dojo"
- attr:
- plugin The plugin to look for the javascript in
- attr:
- contextPath the context path to use (relative to the application context path). Defaults to "" or path to the plugin for a plugin view or template.
- attr:
- base specifies the full base url to prepend to the library name
pluginManager
GrailsPluginManager pluginManager
-
remoteField
java.lang.Object remoteField
- A field that sends its value to a remote link.
- attr:
- name REQUIRED the name of the field
- attr:
- value The initial value of the field
- attr:
- paramName The name of the parameter send to the server
- attr:
- action the name of the action to use in the link, if not specified the default action will be linked
- attr:
- controller the name of the controller to use in the link, if not specified the current controller will be linked
- attr:
- id The id to use in the link
- attr:
- update Either a map containing the elements to update for 'success' or 'failure' states, or a string with the element to update in which cause failure events would be ignored
- attr:
- before The javascript function to call before the remote function call
- attr:
- after The javascript function to call after the remote function call
- attr:
- asynchronous Whether to do the call asynchronously or not (defaults to true)
- attr:
- method The method to use the execute the call (defaults to "post")
remoteFunction
java.lang.Object remoteFunction
- Creates a remote function call using the prototype library.
- attr:
- before The javascript function to call before the remote function call
- attr:
- after The javascript function to call after the remote function call
- attr:
- update Either a map containing the elements to update for 'success' or 'failure' states, or a string with the element to update in which cause failure events would be ignored
- attr:
- action the name of the action to use in the link, if not specified the default action will be linked
- attr:
- controller the name of the controller to use in the link, if not specified the current controller will be linked
- attr:
- id The id to use in the link
- attr:
- asynchronous Whether to do the call asynchronously or not (defaults to true, specified in 'options' array)
- attr:
- method The method to use the execute the call (defaults to "post")
remoteLink
java.lang.Object remoteLink
- A link to a remote uri that used the prototype library to invoke the link via ajax.
- attr:
- update Either a map containing the elements to update for 'success' or 'failure' states, or a string with the element to update in which cause failure events would be ignored
- attr:
- before The javascript function to call before the remote function call
- attr:
- after The javascript function to call after the remote function call
- attr:
- asynchronous Whether to do the call asynchronously or not (defaults to true)
- attr:
- method The method to use the execute the call (defaults to "post")
- attr:
- controller The name of the controller to use in the link, if not specified the current controller will be linked
- attr:
- action The name of the action to use in the link, if not specified the default action will be linked
- attr:
- uri relative URI
- attr:
- url A map containing the action,controller,id etc.
- attr:
- base Sets the prefix to be added to the link target address, typically an absolute server URL. This overrides the behaviour of the absolute property, if both are specified.
- attr:
- absolute If set to "true" will prefix the link target address with the value of the grails.serverURL property from Config, or http://localhost:<port> if no value in Config and not running in production.
- attr:
- id The id to use in the link
- attr:
- fragment The link fragment (often called anchor tag) to use
- attr:
- params A map containing URL query parameters
- attr:
- mapping The named URL mapping to use to rewrite the link
- attr:
- elementId the DOM element id
setProvider
java.lang.Object setProvider
-
submitToRemote
java.lang.Object submitToRemote
- Creates a form submit button that submits the current form to a remote ajax call.
- attr:
- url The url to submit to, either a map contraining keys for the action,controller and id or string value
- attr:
- update Either a map containing the elements to update for 'success' or 'failure' states, or a string with the element to update in which cause failure events would be ignored
- attr:
- before The javascript function to call before the remote function call
- attr:
- after The javascript function to call after the remote function call
- attr:
- asynchronous Whether to do the call asynchronously or not (defaults to true)
- attr:
- method The method to use the execute the call (defaults to "post")
Groovy Documentation