Index: grails-app/taglib/InputTagLib.groovy =================================================================== --- grails-app/taglib/InputTagLib.groovy (revision 45003) +++ grails-app/taglib/InputTagLib.groovy Sun Nov 09 09:38:43 CST 2008 @@ -1,3 +1,5 @@ +import groovy.js.JSCategory + class InputTagLib { static namespace = "gui" @@ -59,9 +61,9 @@ queryMatchContains: false ], attrs, - ['action|url|options'] + ['action|url|options|dataSource'] ) - + def containerId = "c" + grailsUITagLibService.getUniqueId() def resultName = attrs.remove('resultName') def idField = attrs.remove('idField') @@ -76,6 +78,7 @@ def connMethodPost = attrs.remove('connMethodPost') def dependsOn = attrs.remove('dependsOn') def options = attrs.remove('options') + def dataSource = attrs.remove('dataSource') // these apparently just need to be removed from the attrs before they are converted into a js config object def title = attrs.remove('title') @@ -119,7 +122,9 @@ var cfg = {${grailsUITagLibService.mapToConfig attrs}}; """ // of there are options, that means a LocalDataSource - if (options) { + if (dataSource){ + out << use(JSCategory){ dataSource.toJavaScript() } + }else if (options) { out << """ var dataSource = new YAHOO.util.LocalDataSource([${grailsUITagLibService.listToConfig options}]); dataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY @@ -135,8 +140,8 @@ } out << """ - GRAILSUI.${jsid} = new YAHOO.widget.AutoComplete('${id}', '${containerId}', dataSource, cfg); - GRAILSUI.${jsid}.dataSource = dataSource; + GRAILSUI.${jsid} = new YAHOO.widget.AutoComplete('${id}', '${containerId}', ${dataSource?dataSource.'var':'dataSource'}, cfg); + GRAILSUI.${jsid}.dataSource = ${dataSource?dataSource.'var':'dataSource'}; GRAILSUI.${jsid}.prehighlightClassName = 'yui-ac-prehighlight'; GRAILSUI.${jsid}.minQueryLength = 0; GRAILSUI.${jsid}.textboxFocusEvent.subscribe(function() { @@ -260,13 +265,13 @@ YAHOO.util.Event.onDOMReady(function(){ var calPanel; - + GRAILSUI.${jsid} = new YAHOO.widget.Calendar("${id}_cal", { ${grailsUITagLibService.mapToConfig attrs} }); - + ${navigationToInitialDateLogic} - + function cancelHandler() { this.hide(); } @@ -301,8 +306,8 @@ close:false }); GRAILSUI.${jsid}.render(); - - + + calPanel.render(); // Using panel.hide() instead of visible:false is a workaround for an IE6/7 known issue with border-collapse:collapse.