You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Dan Adams (JIRA)" <de...@tapestry.apache.org> on 2008/07/26 18:32:31 UTC

[jira] Commented: (TAPESTRY-2345) DateField customization

    [ https://issues.apache.org/jira/browse/TAPESTRY-2345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12617195#action_12617195 ] 

Dan Adams commented on TAPESTRY-2345:
-------------------------------------

We just had to do this in our application to:
 * change the first day of the way
 * change how the month/year is displayed
 * change some of the button labels
 * add css classes to support styling

Here's an example. The tricky part is that you have make sure this is run after the tapestry and datepicker javascript files.

Tapestry.DateField.prototype.createPopup = Tapestry.DateField.prototype.createPopup.wrap(
	function(proceed){
		proceed();
		this.datePicker.setFirstWeekDay(6);
	}
);

DatePicker.prototype.create = DatePicker.prototype.create.wrap(
	function (proceed, doc){
		var _el = proceed(doc);
		this._noneButton.update('x');
		return _el;
	}
)

You can contribute your own application-wide javascript using something like this in :

    public void contributeMarkupRenderer(
    		OrderedConfiguration<MarkupRendererFilter> config,
                @Path("path/to/app.js") final Asset appJs)
{
    	MarkupRendererFilter filter = new MarkupRendererFilter() {
			public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) {
				RenderSupport renderSupport = environment.peekRequired(RenderSupport.class);
				renderer.renderMarkup(writer);
				renderSupport.addScriptLink(appJs); /* appJs needs to be last so the datefield stuff comes after datefield.js */
			}
    	};
}

> DateField customization
> -----------------------
>
>                 Key: TAPESTRY-2345
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2345
>             Project: Tapestry
>          Issue Type: Bug
>          Components: JavaScript
>    Affects Versions: 5.0.11
>            Reporter: Skow
>            Priority: Minor
>
> I'm unable to find a way to customize the underlying DatePicker that DateField uses.  At the very least, one should be able to change the starting day of the week and attach the 'onchange' event on the text field so something can happen when a date is picked from the popup calendar.  The only workaround I've come up with is to pull the datefield.js out of the Tapestry jar and hard-code the starting day of the week.  I'm still working to getting the onchange event of the text field to fire.  
> Perhaps there is an easy way to do this without actually needing a fix - if so, perhaps all that is needed is a quick wiki howto.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org