tags:

views:

338

answers:

1

Hi,

Does anyone have any experience using the GWT-Ext DatePicker.setDisabledDatesRE(String re) method? I have done the following, and the dates specified in the regular expressions are still selectable. I have been able to disable dates using setDisabledDays, but I need to exclude dates based on criteria other than day of week.

I'm using GWT 1.6.4 and GWT-Ext 2.0.5.

Thanks.

...
import com.gwtext.client.widgets.DatePicker;
...
public class MySimpleDatePicker implements EntryPoint {

  public void onModuleLoad() {

    final Panel panel = new Panel();  
    final Panel calendarPanel = new Panel(); 

    DatePicker datePicker = new DatePicker();  
    Date initialDate = new Date();
    datePicker.setFormat("yyyy-mm-dd");
    datePicker.setValue(initialDate);
    String ddRE = "2009-09-28|2009-09-29";
    datePicker.setDisabledDatesRE(ddRE);
    calendarPanel.add(datePicker);    
    panel.add(calendarPanel);
    RootPanel.get().add(panel);
  }
}
A: 

I figured this out. The argument to setFormat should be "Y-m-d", like this:

DatePicker datePicker = new DatePicker();  
Date initialDate = new Date();
datePicker.setFormat("Y-m-d");
System.out.println("date format is: " + datePicker.getFormat());
datePicker.setMinDate(initialDate);
datePicker.setValue(initialDate);
String ddRE = "09-09-28|09-09-29";
datePicker.setDisabledDatesRE(ddRE);
Lisa