Sunday, November 2, 2014

GWT 2.3: Display blank column for DatePickerCell

If your Column.getValue returns null, you wouldn't be able to popup DatePickerCell.datePicker since you pass null to its datePicker.setValue method.
Here's my solution:

DatePickerCell<Object, Date> cell = new DatePickerCell(datetimeFormatter) {
     @Override
     protected void onEnterKeyDown(Context context,
                                   Element parent,
                                   Date value,
                                   NativeEvent event,
                                   ValueUpdater<Date> valueUpdater) {
         if (value == null)
             value = new Date();
         super.onEnterKeyDown(context, parent, value, event, valueUpdater);
     }
};