Hello,
I wasn’t sure what to search for, so I apologize if the answer is listed somewhere. I’ve got an Input Dialog with two EntityComboBoxes, but the optionsList of the second is dependent on what is selected in the first box. I’m not sure if this can be done or not. Below is what I have set up, but I’m not sure if I’m going in the right direction.
dialogs.createInputDialog(this)
.withCaption("Select User")
.withParameters(
InputParameter.parameter("user")
.withField(() -> {
EntityComboBox<ExtUser> userField = uiComponents.create(
EntityComboBox.of(ExtUser.class));
userField.setOptionsList(users);
userField.setCaption("User");
userField.setWidthFull();
userField.setRequired(true);
userField.addFieldValueChangeListener(changeEvent -> {
ExtUser user = changeEvent.getSource().getValue();
// Can I set the agencyCode input's optionsList here?
});
return userField;
}),
InputParameter.parameter("agencyCode")
.withField(() -> {
EntityComboBox<AgencyCode> agencyCodeField = uiComponents.create(
EntityComboBox.of(AgencyCode.class));
agencyCodeField.setCaption("Agency Code");
agencyCodeField.setRequired(true);
return agencyCodeField;
})
)
.withActions(DialogActions.OK_CANCEL)
.withCloseListener(closeEvent -> {
if (closeEvent.closedWith(DialogOutcome.OK)) {
ExtUser user = closeEvent.getValue("user");
if (getEditedEntity().getAvailabilityType() == AvailableLoadTypeEnum.APPROVED_CARRIER) {
createApprovedCarrierShippingLog(user);
} else if (getEditedEntity().getAvailabilityType() == AvailableLoadTypeEnum.BCO) {
createBCOShippingLog(user);
}
}
})
.show();
Can the userField.addFieldValueChangeListener(changeEvent -> {
line reference the agencyCode input’s optionsList to load it dynamically?
Thanks in advance,
Adam