Open and close all af:showDetail in Oracle ADF

Requirement- functionality to open/close all
Implementation- Use forEach instead of iterator so that you can access children from panelGroupLayout parent component.

Here is the sample code:

    <af:commandButton id="cbShow" text="Show All" icon="/gfx/icons/show.gif" action="#{toggleShowDetails.showAll}"   styleClass="info showHide" iconPosition="trailing" partialSubmit="true"/>  
    <af:panelGroupLayout binding="#{toggleShowDetails.pglDetails}">  
        <af:forEach items="#{pageFlowScope.informationList}" var="blok" varStatus="status">  
              <af:showDetail id="sdInfo" disclosedText="Disclosed" undisclosedText="Undisclosed" partialTriggers="cbShow">  
                   <af:outputText value="Some value"/>  
             </af:showDetail>  
         </af:forEach>  
    </af:panelGroupLayout>  
 
 

    public String showAll() {  
        for(UIComponent child : pglDetails.getChildren()){  
            if(child instanceof RichShowDetail){  
                RichShowDetail showDetail = (RichShowDetail)child;  
                showDetail.setDisclosed(true);  
            }  
          DisclosureEvent event = new DisclosureEvent(showDetail, false);
          event.queue();
        }  
        return null;  
    }  
 

af:iterator is a component by ADF whereas af:forEach is an ADF extension to the JSTL tag c:forEach.
af:iterator doesn’t create multiple copies of each sub component, hence you can’t access all dynamically generated instances for modifying from bean and should not use af:iterator

Happy Learning wit Vinay Kumar

Vinay

I am an Oracle ACE in Oracle ADF/Webcenter. Sr Java Consultant-working on Java/J2EE/Oracle ADF/Webcenter Portal/ content and Hibernate for several years. I'm an active member of the OTN JDeveloper/Webcenter forum. Passionate about learning new technologies. I am here to share my knowledge. Give your views and suggestion on [email protected] .

More Posts - Website

Follow Me:
TwitterLinkedInGoogle PlusYouTube