Gwt checkbox fire handler when setValue (true)

I have a checkbox with valueChangeHandler

on it. It works when the user checks a checkbox.

For some reason I need to set the value of this checkbox in my code like:

checkbox.setValue(true)

, the checkbox is fine checked visually, but my problem is it doesn't fire my valueChangeHandler.

checkBox.setValue(true);

checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
   @Override
   public void onValueChange(ValueChangeEvent<Boolean> event) {
     ...
   }
});

      

Is there any other handler that could be fire when I set the value? Or another way to calculate this?

thank

EDIT : I also tried checkbox.setValue (true, true), but it doesn't work.

RESOLVED : setValue MUST be after registering the handler. Thanks to

+3


source to share


1 answer


What's the difference between setValue(Boolean)

andsetValue(Boolean,boolean)



checkBox.setValue(true, true);

      

+6


source







All Articles