I tried using formatting but i can't disable the cells of the DatePicker I just want to disable all dates before a given date. how do i do that ?
On Jan 20, 6:54 pm, Jim Douglas <[email protected]> wrote: > If you're using a DateBox, you can define a custom Format with your > own parsing rules with: > > setFormat(new CustomDateFormat(DateTimeFormat.getFormat > (pattern))); > > http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/g...) > > private static final String DATE_BOX_FORMAT_ERROR = > "dateBoxFormatError"; > > private class CustomDateFormat extends DateBox.DefaultFormat > { > public CustomDateFormat(DateTimeFormat dateTimeFormat) > { > super(dateTimeFormat); > } > > @Override > public Date parse(DateBox dateBox, String dateText, boolean > reportError) > { > Date date = null; > try > { > if (dateText.length() > 0) > { > date = getDateTimeFormat().parseStrict(dateText); > } > } > catch (Exception exception) > { > // According to the documentation, this should be an > // IllegalArgumentException, but bugs in > DateTimeFormat > // can cause other exceptions to be thrown, for > example: > // java.lang.StringIndexOutOfBoundsException: String > index out of range: 0 > // at java.lang.String.charAt(String.java:558) > // at > com.google.gwt.i18n.client.DateTimeFormat.parseInt(DateTimeFormat.java: > 1415) > } > if (date == null) > { > // If there are other formats you want to support, do > the parsing here > } > if (date != null) > { > // If there aredatesthat you want to disallow, set > date to null here > } > if (date == null && reportError) > { > dateBox.addStyleName(DATE_BOX_FORMAT_ERROR); > } > return date; > } > } > > On Jan 19, 8:02 am, Mark Davis <[email protected]> wrote: > > > Hi, > > > I need todisablespecifieddatesin DatePicker. > > > What is the best way to do it? > > > thanks in advance, > > Mark -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
