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 display data of map in visualforce component ?


I have created one visualforce component to show data from Account object and a custom object CS. Like for one Account, there can be more than one CS object records and I want to show this data in tabular form but I am not getting the data on VF page through which I am calling this component. 
I have created a Map<Id, List<Custom_Object__c>> mapAcc to get the data in the controller but this is not retrieving data on the VF page. 

You need to have <apex:repeat> with either <apex:dataTable> or <apex:pageBlockTable> combined to get this to work. Maybe something like below would work.

<apex:repeat value="{!mapAcc}" var="acctId">
	<apex:dataTable value="{!mapAcc[acctId]}" var="csRecord">
            <apex:outputField value="{!csRecord.Id}"/>
            <apex:outputField value="{!csRecord.Name}"/>