【问题标题】:ADF Cascading Lov Search and Select popup customizationADF Cascading Lov 搜索和选择弹出自定义
【发布时间】:2015-01-20 19:11:04
【问题描述】:
我已经构建了一个包含组和部门字段的级联 LOV(带有值列表的组合框)。当我为 Group 选择一个值并单击 Division 字段的 Search and Select 对话框时,SearchAndSelect 弹出窗口将 Group 和 Division 字段作为搜索条件(在我的视图条件中定义)。
现在,有没有办法在弹出条件中填充 Group 值,我知道 where 子句使用已经输入的 Group 值,但我想在 SearchAndSelect 弹出窗口中将其显示给用户搜索区域。
【问题讨论】:
标签:
oracle-adf
jdeveloper
lov
【解决方案1】:
在 lov 弹出窗口中没有预先设置搜索字段值的声明方式。虽然它可以通过使用 lov 组件的自定义 launchPopupListener 来完成。要了解更多关于如何使用 lov 弹窗监听器的信息,请参考Building Custom Lovs
为依赖的 lov 创建一个 launchPopupListener 方法。
<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>
在launchPopupListener 中,将搜索条件属性的值设置为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
}
}
}
}