Last updated by cfxram 1 week ago
To install the latest version of the dojo plugin (Dojo 1.7.1):
grails install-plugin dojo
To install the 1.6.1 version of Dojo:
grails install-plugin dojo 1.6.1.4
Targets:
grails install-custom-dojo
- This target will build an optimized version of dojo that is tailored to your application. Read the FAQ for more information.
Last updated by cfxram 4 days ago
Installation
To install the Dojo plugin type this command from your project's root folder:
grails install-plugin dojo
The base dojo file will automatically be included in your application under web-apps/js/dojo/1.4.3/dojo/dojo.js. This will give a dojo implementation for <g:formRemote>, <g:remoteField>, <g:remoteFunction>, <g:remoteLink> and <g:submitToRemote>. If you wish to use more of the dojo toolkit in your project, you can include it into your application by using the <dojo> tags.
Getting Started
To use dojo with the built in grails tags add the line to your Config.groovy file:
grails.views.javascript.library="dojo"
Next add the basic dojo header:
<dojo:header theme="soria" showSpinner="true"/>
Then add the theme definition to your body tag:
Include some dojo modules that you would like to use with the <dojo:header> tag or the <dojo:require> tag:
<dojo:header theme="soria" modules="['dijit.layout.TabContainer','dijit.layout.ContentPane', 'dijit.Editor']"/>OR<dojo:header theme="soria"/>
<dojo:require modules="['dijit.layout.TabContainer','dijit.layout.ContentPane', 'dijit.Editor']"/>
Remote Pagination and Sorting
The dojo plugin also comes with <dojo:sortableColumn> and <dojo:paginate> tags. These tags support all the properties that the built-in grails tags supports and mixes in all the properties of the <g:remoteLink> tag.
<dojo:sortableColumn action="getList" property="color" title="Color" update="myUpdateRegion"/><dojo:paginate total="${total}" update="myUpdateRegion" next="Next Page" prev="Prev Page" action="listFragment"/>
Data Grid Tag
<html>
<head>
<title>Simple Grid Example</title>
<dojo:header theme="tundra"/>
<dojo:gridResources/>
<style type="text/css">
.dojoxGridCell {font-size: 12px;}
h2 {margin-top: 0;}
</style>
</head>
<body class="tundra">
<% header = {
return """
<button style="float:left">Selected: ${dojo.bind(variable: 'myGrid.selected')}</button>
<h2>My Widgets ( ${dojo.bind(variable: 'myGrid.rowCount')} )</h2>
"""
} %>
<dojo:grid name="myGrid" controller="widget" action="listJson" max="20" sort="name"
style="height:200px; width:600px" header="${header}" selectable="true">
<dojo:col width="50%" label="Name" field="name">{row.name} ({row.id})</dojo:col>
<dojo:col width="15%" label="Color" field="color"/>
<dojo:col width="15%" label="Shape" field="shape"/>
</dojo:grid>
</body>
</html>The data grid only reads JSON data. So in WidgetController:
class WidgetController { def listJson = {
def widgets,widgetsTotal
widgetsTotal = Widget.list().size();
widgets = Widget.list(params)
render(contentType: "text/json") {
identifier = "id"
numRows = widgetsTotal
items = array{
widgets.each {w ->
item("id":w.id,"name":w.name,"color":w.color,"shape":w.shape)
}
}
}
}
}}
PopOver Tag
<dojo:popOverResources/>
<dojo:popOver label="Click to Activate PopOver" type="button">
<div style="padding:2em">
This is a popover that was activated by a click from a button.
</div>
</dojo:popOver>/* *** OR *** */<dojo:popOver label="Load the action" type="button" controller="widget" action="popOverForm" containLinks="true"/>More Information
Plugin version history
1.7.1.4 (February 7, 2012)
- Switched from shrinksafe to google closure compiler for optimized dojo builds.
- Fixed bugs in the <dojo:editor>
- Addressed issue GPDOJO-12. This allows async=true for AMD modules.
1.7.1.4 (January 30, 2012)
- Fixed a bug in the <dojo:editor>
1.7.1.3 (January 15th, 2012)
- Bug fix for <dojo:tree> rendering issue with static data.
- Added support for defining custom modules in <dojo:header>
1.7.1.2 (January 12th, 2012)
- Bug fix of the static data in <dojo:tree>
- Added <dojo:help> and <dojo:tooltip>
1.7.1.1 (January 10th, 2012)
- Bug fix for the <dojo:editor>
- Bug fix for <dojo:menu>
- Added ability to specify static content in the <dojo:tree>
- Added <dojo:panel>
1.7.0 (January 9th, 2012)
- Upgraded to Dojo 1.7.1
- Added <dojo:datePicker>, <dojo:timerPicker>, <dojo:dateTimePicker>, <dojo:numberPicker>
- Added <dojo:editor>
- Support new dojo optimization builder.
1.6.1.4 (February 1, 2012)
- Fixed a bug in the optimized dojo build process.
1.6.1.4 (January 30, 2012)
- Back-ported all changes in the 1.7.x version of the plugin to the 1.6 version.
- This includes <dojo:menu>, <dojo:editor>, <dojo:help>, and <dojo:tooltip>.
1.6.1.3 (December 5, 2011)
- Supports Grails 2.0.0.RC3
- Added <dojo:tree> (<dojo:treeNode>, <dojo:treeLeaf>)
- Changed <dojo:dataSourceView> to use name property instead of id.
- Removed old unused code like dojoui.js
- (GPDOJO-9) Changed from djConfig to dojoConfig.
- Addded the showSpinner attribute to <dojo:header>
- Addresses github issues #23, #10
1.6.1.2 (October 30, 2011)
- Add support for Grails 2.0.0.RC1
- Fixed 10 minor bugs.
- Changed id to name for most tags that support action and controller. This follows grails conventions.
- Added new attributes to the <dojo:dialog>
- Added <dojo:onload> for <dojo:frames>
1.6.1.1 (September 6, 2011)
- Add support for Grails 2.0
1.6.1.0 (August 27, 2011)
- Upgraded to Dojo 1.6.1
- Works in Firefox 3+ (including 4) IE 6-9
1.4.3.9 (March 9, 2011)
- Fixed bug in <dojo:frame>
- Fixed bug in <dojo:dataSourceView>
1.4.3.8 (February 22, 2011)
- Added <dojo:frame> (<dojo:frameLink>)
- Added <dojo:dialog> (<dojo:closeDialogButton>, <dojo:openDialog>)
- Added <dojo:menu> (<dojo:menuSeparator>, <dojo:menuItem>)
- Added <dojo:tabContainer> (<dojo:contentPane>)
- Minor bug fixes in <dojo:popOver> and <dojo:popOverContent>
1.4.3.7 (February 11, 2011)
- Added controller/action/params properties to the <dojo:popOver> tag. Allows remote content to be loaded.
- Added containLinks to <dojo:popOver>. This keeps form submissions and links in the popOver.
1.4.3.6 (January 31, 2011)
- Added <dojo:grid>, <dojo:col> and <dojo:bind> tags for interacting with Dojo Grids easily.
- Added <dojo:dataSourceView>, <dojo:nodeTemplate>, and <dojo:nodeDefaultTemplate> for dataSource Templates
- Added <dojo:css> for easily adding css files from the dojox namespace.
1.4.3.5 (December 13, 2010)
- Changed the location of the dojo build definition from the dojo.profile.js to the Config.groovy file.
1.4.3.4 (December 7, 2010)
- The full dojo toolkit is now included in the plugin.
- Added new tags to bring dojo into the application: <dojo:header>, <dojo:require>
- Added dojo packaging system to make an optimized dojo release during war creation.
- Removed "install-dojo" script.
- Added the optional "install-custom-dojo" to create an optimized dojo release outside of war creation.
1.4.3.2 (October 9, 2010)
1.4.3.1 (October 5, 2010)
- Added support for simple strings in url param.
- Added dojo taglib with ajax remote paginate and sortableColumn
1.4.3 (October 1, 2010)
For bugs and requests:
http://jira.codehaus.org/browse/GRAILSPLUGINS/component/14542