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
svdsvd 

How to use Map object in Repeat tag in VF Page.

Hi,

I have to use "apex:repeat" tag to repeat some content in VF page. If my controller returns a map, how do I use the map inside the repeat tag.
Here is sample code. I'm facing some problems. How do I iterate through map object. The one shown below in red color is what I wanted. I have 10 accounts in a map. So I want to display them  using repeat object. is this possible. I could do this with List. But i need Map as I need to use the String returned also. please help.

<apex:page>

 <apex:repeat value="{!mapData}" var ="m" >
 
    <apex:pageBlockTable value = {!m.List<Account>} var = "t' >
         <apex:column> {!t.Name} </apex:column>
    </apex:pageBlockTable>
  
 </apex:repeat>

</apex:page>

// controller

public class testCtr()
{
  public Map< String, List<Account> > getMapData()
  {
      Map< String, List<Account> > mapObj = new Map< String, List<Account> >();
      mapObj.put(1,new Account('Test'));

      return mapObj;
  }


}

Any help is appreciated.

Thanks,
DSV