Dojo 1.7.2.0 for Grails

11 votes
Dependency:
compile ":dojo:1.7.2.0"

 Documentation  Source  Issues

Summary

The Dojo Plugin adds the Dojo toolkit to your application. This javascript library provides a complete collection of user interface controls, giving you the power to create web applications that are highly optimized for usability, performance, internationalization, accessibility, but above all deliver an incredible user experience. This plugin provides full support for <g:formRemote>, <g:remoteField>, <g:remoteFunction>, <g:remoteLink> and <g:submitToRemote>. Also adds these two 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. Adds these convenient widget tags: <dojo:header>, <dojo:require>, <dojo:css>, <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:tree> (<dojo:treeNode>, <dojo:treeLeaf>), <dojo:help>, <dojo:toolip>, <dojo:editor>, <dojo:datePicker>, <dojo:timePicker>, <dojo:dateTimePicker>, <dojo:numberPicker> For more information about the Dojo Toolkit please visit http://www.dojotoolkit.org/.

Installation

To install the 1.7.1 version of Dojo (add to BuildConfig.groovy):
compile ":dojo:1.7.2.0"

To install the 1.6.1 version of Dojo (add to BuildConfig.groovy):

compile ":dojo:1.6.1.17"

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.

Description

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.7.2/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:

<body class="soria">

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"/>

CSS Tag

dojo:css   [file]
     example:
        <dojo:css file="dojo/resources/dnd.css" />

More Information

History

Dojo 1.7 History

1.7.2.0 (March 31, 2012)

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.

Dojo 1.6 History

1.6.1.18 (February 18, 2014)

  • Per pull request by Jeremy McKay, added onchange handlers to <dojo:datePicker>, <dojo:timerPicker>, <dojo:dateTimePicker>.
  • Refactored plugin code with fixes from Burt Beckwith

1.6.1.17 (April 29, 2013)

  • Fixed a bug when using the custom build feature with grails 2.2.x versions.

1.6.1.16 (January 23, 2013)

  • Fixed bug in show more capability and any other remoting tag that used the position attribute.
  • Improved grails spinner display for IE 6 and 7.

1.6.1.15 (December 12, 2012)

  • Fixed another bug. Restored old functionality when a dev doesn't specify the new position attribute.

1.6.1.14 (December 11, 2012)

  • Fixed bug introduced in 1.6.1.13 where the failure DOM element was being overwritten by the success DOM.

1.6.1.13 (December 10, 2012)

  • Fixed spinner to always show in the middle of the viewport
  • Added new <dojo:showMore> tag.
  • Added new "position" property for all remote tags. This allows a developer to specify where the content should get loaded. Options are "before, after, first, last, only". (Follows dojo.place() code)

1.6.1.12 (November 9, 2012)

  • Added support for ajax file-uploads in <g:formRemote> and <g:submitToRemote> tags.
  • Fixed issue #38 with g.remoteFunction and formName property.

1.6.1.11 (June 4, 2012)

  • Fixed bug with dojo:frame and submitting multi-part forms.
  • Fixed dijit registry issues when loading new url in dojo:frame when there are open tooltips and drop downs.

1.6.1.10 (April 24, 2012)

  • Fixed loading message with the <dojo:dialog> and the base dojoui.widget.Dialog.js.

1.6.1.9 (March 23, 2012)

  • Fixed a minor but with <dojo:dialog> and using form submissions with containLinks="true".

1.6.1.8 (March 14, 2012)

  • Fixed a bug in the <dojo:editor> that caused IE 6,7, and 8 to break when using multiple editors.

1.6.1.7 (February 17, 2012)

  • Updated <dojo:dialog> and <dojo:editor> to add support for iOS devices.

1.6.1.6 (February 16, 2012)

  • Various bug fixes and improvements in <dojo:tree>, <dojo:dialog>, <dojo:popOver>, and <dojo:editor>

1.6.1.5 (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

Dojo 1.4 Plugin History

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)

  • Minor Bug fixes

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