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