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
ARPITA BOSEARPITA BOSE 

How to display data of map in visualforce component ?

Hi,

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. 


 
logontokartiklogontokartik
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:column>
            <apex:outputField value="{!csRecord.Id}"/>
        </apex:column>
        <apex:column>
            <apex:outputField value="{!csRecord.Name}"/>
        </apex:column>
    </apex:dataTable>
</apex:repeat>