gaboo
4 Dec 2009, 1:40 AM
Hello,
I would like to set the default selection to ComboBox, but unfortunately I
cannot make it. I call the setValue(rec) (or setSelection(java.util.List<D> selection)) method, but in this case all the
other items of store disappear and only the selected item can be seen in the
list.
As i remember it worked with the version of 2.0.1, but does not work with the version of
2.1
Test code:
public class ComboTest implements EntryPoint {
public void onModuleLoad() {
FormPanel p = new FormPanel();
ModelData m1 = new BaseModelData();
m1.set("name", "first");
ModelData m2 = new BaseModelData();
m2.set("name", "second");
ComboBox<ModelData> cb = new ComboBox<ModelData>();
cb.setFieldLabel("Combobox");
cb.setDisplayField("name");
cb.setStore(new ListStore<ModelData>());
cb.getStore().add(Arrays.asList(m1, m2));
p.add(cb);
cb.setValue(m2);
RootPanel.get().add(p);
}
}
Best regards,
Gaboo
I would like to set the default selection to ComboBox, but unfortunately I
cannot make it. I call the setValue(rec) (or setSelection(java.util.List<D> selection)) method, but in this case all the
other items of store disappear and only the selected item can be seen in the
list.
As i remember it worked with the version of 2.0.1, but does not work with the version of
2.1
Test code:
public class ComboTest implements EntryPoint {
public void onModuleLoad() {
FormPanel p = new FormPanel();
ModelData m1 = new BaseModelData();
m1.set("name", "first");
ModelData m2 = new BaseModelData();
m2.set("name", "second");
ComboBox<ModelData> cb = new ComboBox<ModelData>();
cb.setFieldLabel("Combobox");
cb.setDisplayField("name");
cb.setStore(new ListStore<ModelData>());
cb.getStore().add(Arrays.asList(m1, m2));
p.add(cb);
cb.setValue(m2);
RootPanel.get().add(p);
}
}
Best regards,
Gaboo