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
ksmoksmo 

apex repeat

Hi,

Inside the <apex:repeat> I am having around 5 divs which get populated based on the number of times the apex repeat value has.So if there are 5 items the title,checkboxname,heckbox and preview button gets populated 5 times to the side of the item. But for the checkbox alone I want it to populate only once and not 5 times. How do I acheive this?


<div class="xContent">

<apex:repeat value="{!itemList}"
                         var="item">
<div class="xRow">
<div class="xRowRight">

                  
                     
                     <apex:outputPanel rendered="{!ifPDF != true}">
                            
                        <div class="xRowName ">
                                {!benefit.cockpittitle}
                 
                            <div class="xcheckboxname">
                                   CHECKBOXNAME                                                                                      
                                     </div>  <br/>
                                    
                                                                                 
                          </div> 
                       
                        </apex:outputpanel>                      
  <div class="Xrowcategorypanel">

 <div class="Xcheckboxpanel">
                                      <input id="changecolor" type="checkbox" name="BRAND"  onclick="Changecolor()" /> 
                                   
                                 
                                               <div id="XpreviewButton" onclick="ShowPopup()">
                                                     PREVIEW <img class="cockpitImage"
                                               src="{!URLFOR($Resource.BEN_IM, 'magnifying.png')}"/>                               
                                      </div>                                                 
                               </div> 

</div>

</div>
</div>
</div>
 
NagendraNagendra (Salesforce Developers) 
Hi Ksmo,

It will depend on how your data is returned.
  • Instead of returning a List<YOURTYPE> Return a Map<String,List<YOURTYPE>> With the name as the key.
Then in the VF page do something like this:
<apex:repeat value="{!myMap}" var="k">
   ...Output name here....
   <apex:repeat value="{!myMap[k]}" var="v">
      ...output values here.
   </apex:repeat>
</apex:repeat>
Then it just becomes a matter of layout.

Hope this helps.

Regards,
Nagendra