Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ADF panelAccordion problem.

El CocolioJan 9 2025

Hi

I'm new to ADF Faces. I'm trying to create a simple expand/collapse menu by using a panelAccordion component in a page template, with some <af:link>s inside <af:panelGroupLayout layout="vertical">s as stretchable containers for each <af:showDetailItem> in the accordion, but I can't make it work. The <af:showDetailItem>s inside the accordion don't do anything, neither expanding nor collapsing. I need some help here. I've followed the recommendations in the tag documentation, but nothing works.

I'm using JDeveloper v12.2.1.4.0. This was the template code by the time I posted this (relative path: /template/simpleTemplate.xhtml):

<?xml version='1.0' encoding='UTF-8'?>
<af:pageTemplateDef xmlns:af="http://xmlns.oracle.com/adf/faces/rich" var="attrs" definition="private"
                   xmlns:afc="http://xmlns.oracle.com/adf/faces/rich/component" xmlns:f="http://java.sun.com/jsf/core">
 <af:xmlContent>
   <afc:component>
     <afc:description/>
     <afc:display-name>simpleTemplate</afc:display-name>
     <afc:facet>
       <afc:description>Container for data.</afc:description>
       <afc:facet-name>content</afc:facet-name>
     </afc:facet>
   </afc:component>
 </af:xmlContent>
 <af:panelGridLayout id="pt_pgl1">
   <af:gridRow height="50px" id="pt_gr1">
     <af:gridCell width="200px" halign="stretch" valign="stretch" rowSpan="2" id="pt_gc3">
       <!-- Left -->
       <af:panelStretchLayout id="pt_psl1" startWidth="5px" endWidth="5px" topHeight="5px" bottomHeight="400px" dimensionsFrom="parent">
         <f:facet name="start"/>
         <f:facet name="end"/>
         <f:facet name="top"/>
         <f:facet name="bottom"/>
         <f:facet name="center">
           <af:panelAccordion discloseMany="true" id="pt_pa1" dimensionsFrom="parent" discloseNone="true">
             <af:showDetailItem id="menu1" text="MENU 1" flex="2" stretchChildren="first" disclosed="true">
               <af:panelGroupLayout id="pt_pgl2" layout="vertical">
                 <af:link text="link 1" id="pt_l1"/>
                 <af:link text="link 2" id="pt_l2"/>
               </af:panelGroupLayout>
             </af:showDetailItem>
             <af:showDetailItem id="menu2" text="MENU 2" flex="2" stretchChildren="first" disclosed="true">
               <af:panelGroupLayout id="pt_pgl3" layout="vertical">
                 <af:link text="link 3" id="pt_l3"/>
                 <af:link text="link 4" id="pt_l4"/>
               </af:panelGroupLayout>
             </af:showDetailItem>
             <af:showDetailItem text="MENU 3" id="menu3" flex="2" stretchChildren="first" disclosed="true">
               <af:panelGroupLayout id="pt_pgl4" layout="vertical">
                 <af:link text="link 5" id="pt_l5"/>
                 <af:link text="link 6" id="pt_l6"/>
               </af:panelGroupLayout>
             </af:showDetailItem>
           </af:panelAccordion>
         </f:facet>
       </af:panelStretchLayout>
     </af:gridCell>
     <af:gridCell width="100%" halign="stretch" valign="stretch" id="pt_gc2">
       <!-- Partial Header -->
       <af:outputText value="MY TEMPLATE" id="pt_ot1" inlineStyle="font-size:xx-large; font-weight:bold;"/>
     </af:gridCell>
   </af:gridRow>
   <af:gridRow height="100%" id="pt_gr2">
     <af:gridCell width="100%" halign="stretch" valign="stretch" id="pt_gc1">
       <af:facetRef facetName="content" />
     </af:gridCell>
   </af:gridRow>
 </af:panelGridLayout>
</af:pageTemplateDef>

and a sample page:

<?xml version='1.0' encoding='UTF-8'?>
<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
       xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
 <af:document title="Template example" id="exampleDoc">
   <af:pageTemplate id="fe" viewId="/template/simpleTemplate.xhtml">
     <f:facet name="content">
       <af:outputText id="text" value="Hello world!"/>
     </f:facet>
   </af:pageTemplate>
 </af:document>
</f:view>

Please help.

This post has been answered by El Cocolio on Jan 10 2025
Jump to Answer
Comments
Post Details
Added on Jan 9 2025
3 comments
53 views