comment setté la date dans un datePicker SmartGwt
Bonjour, je veux pouvoir donner à l'utilisateur de setter l'heure dans mon DateItem sauf que lorsque je la change à la main et que je perd le focus dans le dateItem le changement n'est plus prit en compte la date revient à la valeur sélectionner via le datePicker.
Voici ma fonction d'initialisation et de gestion du datepicker (Mon DynamicForm startDateForm est bien sûr rajouté dans un canvas dans une autre donction)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| private void initStartDateForm() {
this.startDateForm = new DynamicForm();
this.startDate = new DateItem("start");
this.startDate.setDisplayFormat(DateDisplayFormat.TOSERIALIZEABLEDATE);
this.startDate.setEnforceDate(true);
this.startDate.setRequired(true);
this.startDate.setUseTextField(true);
this.startDate.setTitle("Start Date");
this.startDate.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
SC.warn("ici "+DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(MakeKdmsView.this.startDate.getValueAsDate()));
MakeKdmsView.this.startDate.setValue(DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(MakeKdmsView.this.startDate.getValueAsDate()));
}
});
this.startDateForm.setWidth(300);
this.startDateForm.setBorder("2px solid black");
this.startDateForm.setFields(startDate);
} |