Groovy Documentation

src.groovy.org.codehaus.groovy.grails.plugins.jquery
Class JQueryProvider

java.lang.Object
  src.groovy.org.codehaus.groovy.grails.plugins.jquery.JQueryProvider

class JQueryProvider

author:
Sergey Nebolsin (nebolsin@prophotos.ru)
author:
Finn Herpich (finn.herpich marfinn-software de)


Constructor Summary
JQueryProvider()

 
Method Summary
def buildCallback(def attrs, def out)

Helper method to create callback object

def doRemoteFunction(def taglib, def attrs, def out)

doRemoteFunction creates a jQuery-AJAX-Call

def prepareAjaxForm(def attrs)

success out << 'success:function(data,textStatus){' if(attrs.onLoaded) out << "${attrs.onLoaded};" if(attrs.update instanceof Map) { if(attrs.update?.

 
Methods inherited from class java.lang.Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 

Constructor Detail

JQueryProvider

JQueryProvider()


 
Method Detail

buildCallback

public def buildCallback(def attrs, def out)
Helper method to create callback object
param:
attrs Attributes to use for the callback
param:
out Variable to attache the output


doRemoteFunction

public def doRemoteFunction(def taglib, def attrs, def out)
doRemoteFunction creates a jQuery-AJAX-Call
param:
taglib
param:
attrs
param:
out
return:
the jQuery-like formatted code for an AJAX-request


prepareAjaxForm

public def prepareAjaxForm(def attrs)
success out << 'success:function(data,textStatus){' if(attrs.onLoaded) out << "${attrs.onLoaded};" if(attrs.update instanceof Map) { if(attrs.update?.success) { out << "jQuery('#${attrs.update.success}').html(data);" } } else if(attrs.update) { out << "jQuery('#${attrs.update}').html(data);" } if(attrs.onSuccess) out << "${attrs.onSuccess};" out << '}' //*** failure out << ',error:function(XMLHttpRequest,textStatus,errorThrown){' if (attrs.update instanceof Map) { if (attrs.update?.failure) { out << "jQuery('#${attrs.update?.failure}').html(textStatus);" } } if (attrs.onFailure) out << "${attrs.onFailure};" out << '}' if(attrs.onComplete) out << ",complete:function(XMLHttpRequest,textStatus){${attrs.onComplete}}" } /** Serializes the surrounding form.
param:
attrs attrs.params to serialize


 

Groovy Documentation