1

I have built a cascading LOV with Group and division fields (Combo box with list of values). When I select a value for Group and click on Search and Select dialog for Division field, the SearchAndSelect popup has both Group and Division fields as search criteria(as defined in my view criteria).

Now, is there a way to populate the Group value in the popup criteria, I know the where clause uses the already entered Group value but I want to display it to the user in the SearchAndSelect popup search region.

pnuts
  • 58,317
  • 11
  • 87
  • 139
Soumya R
  • 455
  • 1
  • 5
  • 21

1 Answers1

1

There is no declarative way of pre setting search field values in lov popup. Although it can be done by using a custom launchPopupListener for lov component. To know more about how to use lov popup listeners refer to Building Custom Lovs

Create a launchPopupListener method for your dependent lov.

<af:inputComboboxListOfValues id="inpClv2" popupTitle="Search and Select: #{bindings.StateProvince.hints.label}" value="#{bindings.StateProvince.inputValue}" label="#{bindings.StateProvince.hints.label}" model="#{bindings.StateProvince.listOfValuesModel}" required="#{bindings.StateProvince.hints.mandatory}" columns="#{bindings.StateProvince.hints.displayWidth}" shortDesc="#{bindings.StateProvince.hints.tooltip}" partialTriggers="inpClv1" launchPopupListener="#{backingBeanScope.lovBean.stateLaunchPopupListener}"> </af:inputComboboxListOfValues>

In launchPopupListener set the value of search criteria attribute with the value from first lov.

public void stateLaunchPopupListener(LaunchPopupEvent launchPopupEvent)
{
    UIXInputPopup lovComponent = (UIXInputPopup)launchPopupEvent.getSource();
    ListOfValuesModel model = lovComponent.getModel();
    if (model != null)
    {           
        QueryDescriptor queryDesc = model.getQueryDescriptor();
        /** Code to pre populate a Search and Select field**/
        ConjunctionCriterion conCrit = queryDesc.getConjunctionCriterion();
        List<Criterion> criterionList = conCrit.getCriterionList();
        for (Criterion criterion: criterionList)
        {
            AttributeDescriptor attrDesc = ((AttributeCriterion) criterion).getAttribute();
            if (attrDesc.getName().equalsIgnoreCase("CountryId")) 
            {
                List values = ((AttributeCriterion) criterion).getValues();
                values.set(0, "US"); //use the value from first lov
            }
        }
    }           
}
amishra
  • 951
  • 9
  • 12