Plugins You can find out about all the publicly available Grails plugins.

Grails plugin for YUI 2 Widgets

  • Tags: /
  • Latest: 0.1.2
  • Last Updated: 08 August 2011
  • Grails version: 1.3.7 > *
  • Authors: null
1 vote
compile "org.grails.plugins:grails-yui-widget:0.1.2"




Grails YUI Widget


  • This plugin allows the creation of YUI 2 Widgets via Grails TagLibs


  • Provide a mechanism for instantiating YUI 2 Widgets via Grails TagLib
  • Provide a solid foundation of tags and utilities methods
  • Allow for the highest degree of configuration from TagLib
  • Provide a mechanism for consumer customization
  • Minimize "stitching" Widgets together within generated javascript

Additional Resources

Usage Overview

Each of the tags follow a common pattern for creating YUI Widgets.

  • Call Javascript Constructor with ID and Config.
  • Subscribe to Widget events with event handlers
  • Set properties of the Widget
  • Execute methods against the Widget after construction
       numberConfig : 1,
       stringConfig: 'hello world',
       boolConfig: true,
       arrayConfig : [ 'one', 'two', 'three' ],
       methodConfig: '@jsMethod1' ]}"
        [type: 'widgetEvent1', fn: 'JSMethod2', obj: 'window', scope: 'window' ],
        [type: 'widgetEvent2', fn: 'JSMethod3' ]]"
        [name: 'prop1', val: 'true'],
        [name: 'prop2', val: '@jsMethod4']]}"

So what is going on here?

  • Config: Map of prop/val and collections that will be cast to JSON and passed to YUI Widget
  • Events: Array of Maps containing event definitions to be applied to the YUI Widget
  • Props: Array of Maps containing properties to be set on the YUI Widget
  • Methods: Array of Strings that are applied to the YUI Widget after construction
Additional Notes
  • Javascript Object Literals can be referenced in Config & Props via prefixing the '@' character to the string. A modified version of Crockford's JSON library is used to handle this. In Events, the code assumes the fn property is a JS Literal.
  • Events will assume "null" for obj & scope if they are not specified.

Javascript Inclusion

Plugin Javascript must be included on the page
  • User is responsible for including YUI Javascript/CSS resources
  • Plugin is not dependent on Grails YUI

Tags currently supported

  • AutoComplete
    • yuiWidget:yuiAutoComplete
  • Calendar
    • yuiWidget:yuiCalendar
  • DataSource
    • yuiWidget:yuiLocalDataSource
    • yuiWidget:yuiXHRDataSource
  • DataTable
    • yuiWidget:yuiDataTable
    • yuiWidget:yuiScrollingDataTable
  • Dialog
    • yuiWidget:yuiToolTip
    • yuiWidget:yuiSimpleDialog
    • yuiWidget:yuiDialog
    • yuiWidget:yuiPanel
  • Paginator
    • yuiWidget:yuiPaginator



Version 0.1.2
  • Removed JSON Source - Added JSON JAR
Version 0.1.1
  • Added Calendar support
Version 0.1.0
  • Initial release