Tuesday, November 25, 2008

Examples of AJAX Elements in Grails

I am very impressed with the rapid development Grails Offers, the power of AJAX which grails offers has made it even more powerful. Grails offers many AJAX frameworks which can be added as plugins.
Grails also offers some built in functionalities, with
  • g:remoteFunction
  • g:formRemote
  • g:remoteField
  • g:remoteLink
  • g:submitToRemote

Following are common attributes of mentioned tags following are really useful:
  • controller - name of the controller to use
  • action - name of the action within controller
  • update - element to update or map containing elements to update in the case of success or failure
  • params - parameters to send with the call

Attribute that really enables AJAX behavior is value of update attribute. Content of the page placed between

div id="value_of_the_update_attribute"

For other attributes and more details look at the grails documentation.

Lets look at example of each one,

1.
g:remoteFunction
Use g:remoteFunction to populate comboboxes, RadioButtons with the values recieved by invoking a function/action on the Controller,
Check the Example out on JAN Blog

2.


No comments: