ADF selectOnechoice how to display label in items

妖精的绣舞 提交于 2019-12-24 07:46:59

问题


I am working on ADF. I need to display help text on mouse hover for each value of drop down. I struggled al lot but dint find any thing to do in model layer. Finally I endded up playing with string EL expression.

<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>

My problem is select item is not displaying substring it is displaying only value. I did use valuePassThrough but no luck.


回答1:


Try a define method for initialize to 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);
          }

and bind this list to 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>


来源:https://stackoverflow.com/questions/44412785/adf-selectonechoice-how-to-display-label-in-items

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!