我有4个DateBox,它们就像:
date1.addValueChangeHandler(new CustomValueChangeHandler());
date2.addValueChangeHandler(new CustomValueChangeHandler());
date3.addValueChangeHandler(new CustomValueChangeHandler());
date4.addValueChangeHandler(new CustomValueChangeHandler());
private class CustomValueChangeHandler implements ValueChangeHandler {
public void onValueChange(ValueChangeEvent event)
{
现在我有一个单选的celltable,其selectionChange就像:
selectionModel.addSelectionChangeHandler(new Handler() {
@SuppressWarnings("deprecation")
@Override
public void onSelectionChange(SelectionChangeEvent event)
{
Person person = selectionModel.getSelectedObject();
date1.setValue(person.getStartDate());
date2.setValue(person.getEndDate());
date3.setValue(person.getStartTime());
date4.setValue(person.getEndTime());
}
});
选择更改事件是将日期值设置为ok,但问题是date1,date2,date3,date4具有ValueChangeHandler并且它们没有触发
答案 0 :(得分:0)
setValue()
方法不会触发更改事件。您可以使用第二个参数强制触发事件。使用
date1.setValue(person.getStartDate(), true);