I have a combobox that I’d like to change based on the value of another box, but the onChange event will never fire. In Classic, it worked exactly as I needed it.
@ViewComponent
private JmixComboBox<String> equipmentTypeField;
@ViewComponent
private JmixComboBox<String> modelType;
@Subscribe
public void onInit(InitEvent event) {
List<String> equipmentTypelist = new ArrayList<>();
equipmentTypelist.add("Type1");
equipmentTypelist.add("Type2");
equipmentTypelist.add("Type3");
equipmentTypelist.add("Type4");
Collections.sort(equipmentTypelist);
equipmentTypeField.setItems(equipmentTypelist);
}
@Subscribe("equipmentTypeField")
public void onChange(HasValue.ValueChangeEvent event) {
System.out.println("Got change");
List<String> modelTypeList = new ArrayList<>();
if (event.getValue() == "Type1") {
System.out.println(event.getValue());
modelTypeList.add("R1");
modelTypeList.add("R2");
modelTypeList.add("R3");
} else if (event.getValue() == "Type2") {
modelTypeList.add("N1");
modelTypeList.add("N2");
modelTypeList.add("N3");
} else if (event.getValue() == "Type3") {
modelTypeList.add("P1");
}