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
OdedHarnivOdedHarniv 

Arranging the buttons in two rows with repeat

Hello

 

I have this code:

<apex:panelGrid columns="2" id="bottomGrid">       

	<apex:repeat value="{!Campaign.Campaign_Selection_Options__r}" var="cso">
	  <apex:commandButton rendered="{!showButtons}" onclick="buttonClick('{!cso.Name}')" styleClass="buttonStyle" action="{!doAction}" value="{!cso.Name}" id="button1" >           
  </apex:commandButton>					    
</apex:repeat>
      
</apex:panelGrid>   

 

I have 3 or 4 buttons depending on the specific record and I hopped the buttons would be arranged in the grid in two rows.

In practice the buttons get arranged in one row.

 

Does any one know how can I force them to be arranged according to my grid?

 

Thanks

 

Oded

bob_buzzardbob_buzzard

This is documented behaviour I'm afraid:

 

--- snip ---

 

Note that if an <apex:repeat> component is used within an <apex:panelGrid> component, all content generated bythe <apex:repeat> component is placed in a single <apex:panelGrid> cell.

 

--- snip ---

 

I reckon you'll need to use a standard HTML table for this.  The difficult bit is that you'll need your repeat to iterate over a list of pairs of buttons, which sounds like a wrapper class.