Skip to content

cfxram/grails-dojo

Repository files navigation

Adds Dojo as a Javascript Provider for Grails. This provides full support for
<g:formRemote>, <g:remoteField>, <g:remoteFunction>, <g:remoteLink> and <g:submitToRemote>.

Also adds two dojo tags: <dojo:paginate> and <dojo:sortableColumn>. These do the same thing
that the Grails versions of the tags but will do them via ajax calls.

The dojo toolkit is bundled with the library so to add more dojo resources to your app, use
the tags: <dojo:header> and <dojo:require>.

The Dojo Plugin adds some simple tags for interacting with dojo:

<dojo:header>
<dojo:require>
<dojo:css>
<dojo:paginate>
<dojo:sortableColumn>
<dojo:grid> (<dojo:col>, <dojo:bind>)
<dojo:dataSourceView>(<dojo:nodeTemplate>, <dojo:nodeDefaultTemplate>)
<dojo:popOver> (<dojo:popOverContent>, <dojo:closePopOver>)
<dojo:frame> (<dojo:frameLink> <dojo:onload>)
<dojo:dialog> (<dojo:closeDialog>, <dojo:openDialog>)
<dojo:tree> (<dojo:treeNode>, <dojo:treeLeaf>)

Contributed Tags:
<dojo:menu> (<dojo:menuSeparator>, <dojo:menuItem>)
<dojo:tabContainer> (<dojo:contentPane>)

The Dojo Plugin also allows you to create a custom dojo release tailored for your application.
This can be done during war creation or manually using the "install-custom-dojo" Grails script.
Then add these settings to your Config.groovy file:
dojo.optimize.during.build = true;
dojo.use.customBuild.js = true;
dojo.use.customBuild.css = true;
dojo.profile = """
dojo.profile = """
    dependencies = {
        layers:  [
            {
                name: "custom-dojo.js",
                dependencies: [
                    "dijit.layout.TabContainer",
                    "dijit.layout.ContentPane"
                ]
            }
        ],
        prefixes: [
            [ "dijit", "../dijit" ],
            [ "dojox", "../dojox" ],
            [ "css", "../css" ],
            [ "dojoui", "../dojoui" ]
        ],
        // This is a customization to the standard dojo build profile. Only the
        // dojo plugin build process will understand this. It will just be
        // ignored by the standard dojo build.
        css: {
            dependencies: [
                "../dojo/resources/dojo.css",
                "../dijit/themes/dijit.css",
                "../dijit/themes/tundra/tundra.css",
                "../dojox/grid/resources/tundraGrid.css",
                "../dojoui/resources/css/dojo-ui.css"
            ]
        }
    }
"""

Follow the instructions here to determine what goes in the dojo.profile setting here:
http://www.dojotoolkit.org/reference-guide/quickstart/custom-builds.html
For more information about the Dojo Toolkit please visit http://www.dojotoolkit.org/.