ADF selectOnechoice如何在项目中显示标签

时间:2017-06-07 12:35:06

标签: oracle-adf

我正在研究ADF。我需要在鼠标悬停时显示每个下拉值的帮助文本。我努力奋斗但是在模型层找到任何事情要做。最后我结束了使用字符串EL表达式。

<af:table value="#{bindings.LetterUIConfig1.collectionModel}" rendered="false"
        width="98%" styleClass="AFStretchWidth" var="row"
        rows="#{bindings.LetterUIConfig1.rangeSize}"
        emptyText="#{bindings.LetterUIConfig1.viewable ? 'No data to display.' : 'Access Denied.'}"
        fetchSize="#{bindings.LetterUIConfig1.rangeSize}"
        rowBandingInterval="0" id="t1" columnStretching="column:c1"
        inlineStyle="border-style:hidden;" horizontalGridVisible="false"
        verticalGridVisible="false">
<af:column sortProperty="#{bindings.LetterUIConfig1.hints.Name.name}"
           sortable="false" id="c1" noWrap="false" headerText="">
  <af:panelFormLayout id="pfl1" labelWidth="40%" fieldWidth="60%"
                      maxColumns="1" labelAlignment="start">
    <af:panelLabelAndMessage label="#{row.Name}" id="plam1"
                             styleClass="alignLeft"
                             labelStyle="text-align: left;">
      <af:panelGroupLayout id="pgl1">

        <af:selectOneChoice value="#{row.bindings.Name.inputValue}"
                            label="#{row.bindings.Name.label}"
                            required="#{bindings.LetterUIConfig1.hints.Name.mandatory}"
                            shortDesc="#{bindings.LetterUIConfig1.hints.Name.tooltip}"
                            id="soc1">
            <af:forEach items="#{bindings.LetterAttributeLOV.rangeSet}" var="list">
                <af:selectItem id="si1" value="#{list.AttVal}"/>
          </af:forEach>
        </af:selectOneChoice>
        <af:selectBooleanCheckbox value="#{row.bindings.Name.inputValue}"
                                rendered="#{row.Type eq 'SBC'}"
                                label="#{row.bindings.Name.label}"
                                shortDesc="#{bindings.LetterUIConfig1.hints.Name.tooltip}"
                                id="sbc1"/>
      <af:selectManyCheckbox label="#{row.Name}" id="smc1"
                             rendered="#{row.Type eq 'SMC'}">
        <f:selectItems value="#{row.bindings.Name.items}" id="si2"/>
      </af:selectManyCheckbox>
      </af:panelGroupLayout>
    </af:panelLabelAndMessage>
  </af:panelFormLayout>
  <af:spacer id="s1" height="10"/>
</af:column>

我的问题是选择项目没有显示子字符串,它只显示值。我确实使用了valuePassThrough,但没有运气。

1 个答案:

答案 0 :(得分:1)

尝试使用define方法初始化为itemList;

public List getSelectItemList(){
    ArrayList list = new ArrayList();
    Iterator<Object> iterator = resolveExpression("#{bind here your LOV}");
        while (iterator.hasNext()) {
          Object obj= iterator.next();
          list.add(new SelectItem(enterObjValue, enterObjValueLabel));
        }
        return list;
      }  

 public Object resolveExpression(String expression) {
            FacesContext fc = getFacesContext();
            ELContext elCtx = fc.getELContext();
            return fc.getApplication().getExpressionFactory().createValueExpression(elCtx, expression, Object.class).getValue(elCtx);
          }

并将此列表绑定到Select one choice component。

 <af:selectOneChoice value="#{row.bindings.Name.inputValue}"
                        label="#{row.bindings.Name.label}"
                        required="#{bindings.LetterUIConfig1.hints.Name.mandatory}"
                        shortDesc="#{bindings.LetterUIConfig1.hints.Name.tooltip}"
                        id="soc1">
      <f:selectItems value="#{yourBean.selectItemList}"
                           id="sadsadsa"/>
    </af:selectOneChoice>