Friday, February 15, 2008

Grails adaptive AJAX support with the Yahoo! UI Library



Grails ships out of the box with adaptive AJAX support.
By default Grails uses the Prototpe library when invoking AJAX request using the Grails remoteLink, formRemote and submitToRemote AJAX tags.

Not only is Grails providing an easy way of integrating AJAX functionality in your pages, but it also allows you to switch to another AJAX library if needed. This is what we mean with adaptive AJAX support.

One of the use cases to switch to another AJAX library is that this library offers more functionality then the default Prototype library. E.g. you want to use the Yahoo! User Interface Library (YUI) within you application for the autocomplete or calendar functionality. In this case you want the YUI library also to be used for your AJAX tags, so you only depend on YUI and not on both YUI and Prototype.

If you want easy support for YUI in your Grails application then just install the Grails Yahoo! UI Library Plugin which I released today. It downloads and installs automatically the latest YUI 2.4.1 2.5.0 distribution in your application, and registers itself to be used with the adapative AJAX tags. It also contains two helper tags to easily include additional YUI javascript and css files as well.

Note that this plugin does not provide any tags for embedding rich ui components without having to deal with javascript libraries. If you are more interested in such a plugin, have a look at the Grails RichUI Plugin. This plugin contains a set of AJAX components not limited to the YUI library.

For a personal application I want to use the YUI autocomplete and calendar functionality so I'm thinking already of a Grails YUI Widgets Plugin which can be installed on top of the YUI Plugin ...

2 comments:

dahernan said...

Great!! I'm interested in the new yui uploader.

http://developer.yahoo.com/yui/uploader/

Anonymous said...

Hi Marcel !

This is indeed a very useful blog! Good work !

I'am relatively new to YUI and have been working with Java-YUI in a spring Mvc layout.

I have a question / doubt !

I instantiate a Yui datatable from a local datasource! and I edit the contents of the datatable. Now My job is almost done if I can populate all these data back into the datasource ! In my case a html table ! Is this possible ? I have done loads of googling on this in vain !

Any clue , is highly appreciated!

Regards,
Vinoth