Problems with DatePicker

75 views
Skip to first unread message

Chris Ainsley

unread,
Mar 19, 2013, 4:20:55 AM3/19/13
to gwt-bo...@googlegroups.com
Hello,

I'm integrating DatePicker into a form I'm developing and I'm encountering the following issues:

1) I can't set the 'name' attribute of the DateBox. I looked at the source and you have a protected method to access the box, but I believe this should either be public or the setName() attribute should be exposed. Without setName(), the form widget cannot POST properly. So far, I am working around this by directly setting the 'name' attribute on the element. I'm trying to add a keyUpHandler() to the DateBox for the purpose of validating a Date as the user types the date, and the same problem gets in my way.

2) I'd like to be able to control the enabled dates programmatically. Something like:

dateBox.setDateEnabledFilter
(new DateEnabledFilter()
{
   
@Override
   
public List<Date> getDisabledDates(Date startDate, Date endDate) {
     
// return a list of dates that are disabled or an empty list id none are enabled
   
}
}
);


I realise that a more simple version of this API would be to simply have a single method that returns a boolean for a particular date, but typically the date widget displays a batch of dates all at the same time, and the enabled or disabled dates may have to await an RPC callback linking to a server-side holiday calendar, so the batch approach is probably more performant for this use-case.

I also realise that there is a setStartDate() and setEndDate() methods to assist with this type of logic, but being able to selectively render at a granular date level is much better overall.

I understand that the "onRender()" Javascript function can be overloaded to achieve granular per-date rendering/disabling of dates : http://www.eyecon.ro/bootstrap-datepicker/

Any thoughts are welcome.

Thanks,

Chris

Chris Ainsley

unread,
Mar 19, 2013, 6:04:42 PM3/19/13
to gwt-bo...@googlegroups.com
3) I've also discovered that setting a DateBox to readonly, does not actually stop the clicking of the datebox from bringing up the datebox dialogue and allowing the user to change the value of the date within the dialogue.
Reply all
Reply to author
Forward
0 new messages