1

我已经用 Group 和 Division 字段(带有值列表的组合框)构建了一个级联 LOV 。当我为 Group 选择一个值并单击Search and SelectDivision 字段的对话框时,SearchAndSelect 弹出窗口将 Group 和 Division 字段都作为搜索条件(在我的视图条件中定义)。

现在,有没有办法在弹出条件中填充Group 值,我知道 where 子句使用已经输入的 Group 值,但我想在 SearchAndSelect 弹出搜索区域中向用户显示它。

4

1 回答 1

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
            }
        }
    }           
}
于 2015-01-21T06:52:06.740 回答