function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to implement a button control for apex:panelBar?

How would I implement a button control for an apex:panelBar? I have a Previous and Next button that increase/decrease the selectedTabNumber, it updates the {!selectedTabNumber} correctly and my if statement is correct but it does not seem to have an effect on the expanded="{!IF(selectedTabNumber == tab.tabnumber, true, false)}" attribute in the apex:panelBarItem. What am I missing?

Thanks, Matt


<div><apex:commandButton reRender="tabPanel" action="{!prevSection}" value="Previous"/>&nbsp;
    <apex:commandButton reRender="tabPanel" action="{!nextSection}" value="Next"/>&nbsp;

<apex:panelBar id="tabPanel" items="{!tabs}" var="tab" switchType="server" headerClass="panel" headerClassActive="panelActive">
<apex:panelBarItem expanded="{!IF(selectedTabNumber == tab.tabnumber, true, false)}" label="{!tab.tabName}" >
    selected {!selectedTabNumber} of {!tab.tabnumber} this tab {!IF(selectedTabNumber == tab.tabnumber, true, false)}
//content removed



Can you make sure that selectedTabNumber,tab.tabnumber are initialised to some value ?
And also try to put the formula {!IF(selectedTabNumber == tab.tabnumber, true, false)} somewhere above the PanelBarItem to debug.