1 Reply Latest reply on May 1, 2013 4:55 AM by Kaja Rajesh

    How to Conditionally Render Command link within af:forEach

    Kaja Rajesh

      We have a requirement to conditionally Display/Hide CommandLink item in af:forEach Loop.And this customization is on the Fusion Compensation applications

      <af:forEach items="#{bindings.RegionalAreaPVO.rangeSet}" var="parent">
      <af:spacer height="10" id="s1"/>
      <af:commandLink inlineStyle="font-weight:bold;" text="#{parent.ItemName}" partialSubmit="true" actionListener="#{backingBeanScope.RegionalAreaBean.launchTaskflow}" id="cl1" rendered="#{backingBeanScope.XXWFCRegionalAreaBean.modelEligibleflag eq true}">
      <af:setActionListener from="#{parent.Code}" to="#{parentNode}"/>

      I have added a Cutom Managed Bean Class and Returning boolean value to Control Render property which is working. But now i want to add business Logic based on 'parent.ItemName' or 'parentNode' Values in the bean method to return proper Boolean value.
      But i am unable to get the Current Iteration values in the bean method.

      I am using below EL expressions to get the values. But no luck.

      String nameel = (String)ADFUtil.evaluateEL("#{bindings.parent.ItemName}");
      String codeel = (String)ADFUtil.evaluateEL("#{parent.Code}");
      String nodeEl = (String)ADFUtil.evaluateEL("#{parentNode}");

      Also, i have tried getting the Row object like below but i am getting the First row details always. My intention is to get Current row values and use them for Business logic.

      ViewRowImpl row =
      (ViewRowImpl)ADFUtil.evaluateEL("#{bindings." + VoName +

      String code = (String)row.getAttribute("Code");

      Third option i have tried is to add a dummy Outputtext and have assigned #parent.Code as Value. Idea is to find Component of OutPut text in managed Bean and get the value of it. If Value is say "Model" i want to add more Logic and return true/false accordingly. In this also, i am getting all occurences of Output text in Managed bean and i a unable to identify Current Iterator Index.

      Any help is highly appreciated on how can i render Command link Conditionally based on forEach Loop values and Index.