1

我有以下麻烦。我有一个包含区列表的组合框,现在当组合框的值更改时,我还必须更改 TwinColSelect 左列的值,但右列必须保持不变。

我能怎么做?

4

1 回答 1

0

My advice is to extends TwinColSelect and in there set the containerDataSource and setValue by yourself on

Example:

public class MyTwinColSelect
    extends TwinColSelect {

   public MyTwinColSelect(List<T> dataSource, List<T> value) {
      setContainerDataSource(new BeanItemContainer<T>(dataSource));
      setValue(value);
   }

   public updateDataSource(List<T> newDataSource) {
      setContainerDataSource(new BeanItemContainer<T>(newDataSource));
   }
}

And for ComboBox:

comboBox.addValueChangeListener(new ValueChangeListener() {

   private static final long serialVersionUID = 1L;

   @Override
   public void valueChange(ValueChangeEvent event) {
      twincolselect.updateDataSource(newDataSource);
   }
});
于 2014-05-23T07:21:07.160 回答