Wednesday, December 30, 2009

Problem with the datebox : handling to value change events when setting a format

Hi,

I've just detecting a problem with the datebox widget with GWT 2.0,
the widget works well but when I set a format to the datebox two value
change events are handled by the datebox.

Does anyone 's got a solution or know that is a bug already known by
the GWT team ?

(Except the solution that need to write more code in using
db.getDatePicker().addValueChangeHandler + db.getTextBox
().addValueChangeHandler)

Regards,


A small piece of code to see the behaviour :

public static final Format dateboxFormat=new DateBox.DefaultFormat
(DateTimeFormat.getFormat("dd/MM/yyyy"));

[...]

DateBox db=new DateBox();
db.setFormat(dateboxFormat);
fp.add(db);

// After selecting a date on the datepicker popup
db.getDatePicker().addValueChangeHandler(new
ValueChangeHandler<Date>() {

@Override
public void onValueChange(ValueChangeEvent<Date> event) {
Window.alert("datepicker");

}
});
// After editing manually the date in the textbox
db.getTextBox().addValueChangeHandler(new ValueChangeHandler<String>
() {

@Override
public void onValueChange(ValueChangeEvent<String> event) {
Window.alert("text");

}
});
// After selecting a date on the datepicker popup OR editing
manually the date in the textbox
// Two events are triggered for one date change when a setFormat
(...) is set to a datebox.
db.addValueChangeHandler(new ValueChangeHandler<Date>() {

@Override
public void onValueChange(ValueChangeEvent<Date> event) {
Window.alert("datebox"); //Got it twice for one date editing

}
});

--

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate