GWT 2.5.0
smartgwt 3.1
Firefox 18.0
Is there a way to not show the "Today" button in the DateChooser for the DateTimeItem form field ?
I tried to do setAttribute("showTodayButton", false) hoping it will work but didn't. So I tried to create my own DateTimeField with my own DateChooser and was able to call setShowTodayButton to false to not show the "Today" button but encountered at least 3 issues so far, please see attachment that shows these issues:
1). The date chooser always shows up at the top left corner. Tried doing setAutoShowParent(true) with no effect.
2). The scroll bars appears on the side making it hard to choose the right most column. Tried doing setAutoHeight(), setAutoWidth(), DC.setOverflow(Overflow.VISIBLE), DC.setScrollbarSize(0) with no effect.
3). The wrong month "Apr 2013" header displays initially; it should be "Aug 2013". The date is highlighted correctly though and when you click the next month arrow on the top, it will show "Sep" which is correct.
Here is the sample test case:
public class DateTimeTestCase implements EntryPoint {
public void onModuleLoad() {
DateTimeFormat formatter = DateTimeFormat.getFormat("yyyy-MM-dd'T'HH:mm:ss"); // Browser time zone is US/Pacific +08:00
Date aDate = formatter.parse("2013-08-08T08:00:00");
GWT.log("aDate: "+aDate);
final DateTimeItemExt dateTime = new DateTimeItemExt();
dateTime.setTitle("Date Time ");
dateTime.setWrapTitle(false);
dateTime.setDefaultChooserDate(aDate);
final DynamicForm form = new DynamicForm();
form.setAutoFocus(true);
form.setHeight100();
form.setWidth100();
form.setPadding(25);
form.setFields(dateTime);
form.draw();
}
public class DateTimeItemExt extends DateTimeItem {
private DateChooser DC = new DateChooser();
private DateTimeItemExt myself;
public DateTimeItemExt() {
this.myself = this;
DC.addDataChangedHandler(new DataChangedHandler(){
@Override
public void onDataChanged(
com.smartgwt.client.widgets.events.DataChangedEvent event) {
DC.hide();
myself.setValue(DC.getData());
}
});
DC.setShowTodayButton(false);
DC.setShowCancelButton(true);
DC.setCancelButtonTitle("Cancel");
DC.setAutoShowParent(true);
DC.setAutoHeight();
DC.setAutoWidth();
DC.setOverflow(Overflow.VISIBLE);
DC.setScrollbarSize(0);
PickerIcon datePicker = new PickerIcon(PickerIcon.DATE, new FormItemClickHandler() {
@Override
public void onFormItemClick(FormItemIconClickEvent event) {
DC.show();
}
});
setShowPickerIcon(false);
setIcons(datePicker);
}
public void setDefaultChooserDate(Date date) {
DC.setData(date);
}
}
}
So my customized date chooser is not working out for me but the built-in DateTimeItem form field is working except I just don't want to show the "Today" button.
Please anyone, I am desparately need your help on this if you know a way like thru javascript to hide the "Today" button from the Date picker.
Thank you very much in advance !
smartgwt 3.1
Firefox 18.0
Is there a way to not show the "Today" button in the DateChooser for the DateTimeItem form field ?
I tried to do setAttribute("showTodayButton", false) hoping it will work but didn't. So I tried to create my own DateTimeField with my own DateChooser and was able to call setShowTodayButton to false to not show the "Today" button but encountered at least 3 issues so far, please see attachment that shows these issues:
1). The date chooser always shows up at the top left corner. Tried doing setAutoShowParent(true) with no effect.
2). The scroll bars appears on the side making it hard to choose the right most column. Tried doing setAutoHeight(), setAutoWidth(), DC.setOverflow(Overflow.VISIBLE), DC.setScrollbarSize(0) with no effect.
3). The wrong month "Apr 2013" header displays initially; it should be "Aug 2013". The date is highlighted correctly though and when you click the next month arrow on the top, it will show "Sep" which is correct.
Here is the sample test case:
public class DateTimeTestCase implements EntryPoint {
public void onModuleLoad() {
DateTimeFormat formatter = DateTimeFormat.getFormat("yyyy-MM-dd'T'HH:mm:ss"); // Browser time zone is US/Pacific +08:00
Date aDate = formatter.parse("2013-08-08T08:00:00");
GWT.log("aDate: "+aDate);
final DateTimeItemExt dateTime = new DateTimeItemExt();
dateTime.setTitle("Date Time ");
dateTime.setWrapTitle(false);
dateTime.setDefaultChooserDate(aDate);
final DynamicForm form = new DynamicForm();
form.setAutoFocus(true);
form.setHeight100();
form.setWidth100();
form.setPadding(25);
form.setFields(dateTime);
form.draw();
}
public class DateTimeItemExt extends DateTimeItem {
private DateChooser DC = new DateChooser();
private DateTimeItemExt myself;
public DateTimeItemExt() {
this.myself = this;
DC.addDataChangedHandler(new DataChangedHandler(){
@Override
public void onDataChanged(
com.smartgwt.client.widgets.events.DataChangedEvent event) {
DC.hide();
myself.setValue(DC.getData());
}
});
DC.setShowTodayButton(false);
DC.setShowCancelButton(true);
DC.setCancelButtonTitle("Cancel");
DC.setAutoShowParent(true);
DC.setAutoHeight();
DC.setAutoWidth();
DC.setOverflow(Overflow.VISIBLE);
DC.setScrollbarSize(0);
PickerIcon datePicker = new PickerIcon(PickerIcon.DATE, new FormItemClickHandler() {
@Override
public void onFormItemClick(FormItemIconClickEvent event) {
DC.show();
}
});
setShowPickerIcon(false);
setIcons(datePicker);
}
public void setDefaultChooserDate(Date date) {
DC.setData(date);
}
}
}
So my customized date chooser is not working out for me but the built-in DateTimeItem form field is working except I just don't want to show the "Today" button.
Please anyone, I am desparately need your help on this if you know a way like thru javascript to hide the "Today" button from the Date picker.
Thank you very much in advance !
Comment