Search code examples
oracle-adfjdeveloper

Clear dependent attribute values on changing parent attribute


I have a parent attribute OrganizationId and attributes- ProjectId which is dependent on OrganizationId . So on clearing/updating OrganizationId ProjectId should be removed.In current scenarion on clearing OrganizationId we aren't able to select any ProjectId from though the existing ProjectId value still shows on page.

<af:inputComboboxListOfValues id="OrganizationCode"
    popupTitle="#{ResourcesGenBundle['Header.SearchandSelect.Searchandselectanobjectusingad']}: #{bindings.OrganizationCode.hints.label}"
    value="#{bindings.OrganizationCode.inputValue}"
    label="#{bindings.OrganizationCode.hints.label}"
    model="#{bindings.OrganizationCode.listOfValuesModel}"
    required="#{bindings.OrganizationCode.hints.mandatory}"
    columns="#{bindings.OrganizationCode.hints.displayWidth}"
    shortDesc="#{bindings.OrganizationCode.hints.tooltip}"
    searchDesc="#{bindings.OrganizationCode.hints.tooltip}"
    autoSubmit="true"
    partialTriggers="DeliveryName"
    valueChangeListener="#{CreatePickWaveBean.onOrganizationCodeChange}"
    binding="#{CreatePickWaveBean.organizationCode}">

<af:inputListOfValues id="projCostingProjectNumberId"
    popupTitle="#{ResourcesGenBundle['Header.SearchandSelect.Searchandselectanobjectusingad']}: #{bindings.ProjCostingProjectNumber.hints.label}"
    value="#{bindings.ProjCostingProjectNumber.inputValue}"
    label="#{wshpickreleaseuiBundle['ColAttr.ProjectCostingProjectNumber.ProjectPVO.ProjectCostingProjectNumber']}"
    model="#{bindings.ProjCostingProjectNumber.listOfValuesModel}"
    required="#{bindings.ProjCostingProjectNumber.hints.mandatory}"
    columns="#{bindings.ProjCostingProjectNumber.hints.displayWidth}"
    shortDesc="#{bindings.ProjCostingProjectNumber.hints.tooltip}"
    autoSubmit="true"
    binding="#{CreatePickWaveBean.pjcProjectNumber}"
    valueChangeListener="#{CreatePickWaveBean.onPjcNumberChange}">


public void onOrganizationCodeChange(ValueChangeEvent valueChangeEvent) {
    updateEVH(getOrganizationCode());

    private void updateEVH(EditableValueHolder evh) {
    if (evh != null)
        evh.setSubmittedValue(null);
}

Solution

  • Try to reset the value or to set value null for inputListOfValues OrganizationId changed

    You already set the binding for projectId component to "#{CreatePickWaveBean.pjcProjectNumber}" So you can use the following code in The Value change listener method for ProjectId

    this.getPjcProjectNumber().setValue(null);
    

    or

    this.getPjcProjectNumber().resetValue();