0

Good day everyone,

I have created a wrapper class which is something like this:

public class wrapperClass {
        public Map<String,List<String>> selectedDefinitionList{get;set;}
        public Boolean isSelect{get;set;}
        public wrapperClass(Map<String,List<String>> selectedDefinitionList, boolean isSelect ) {
            this.selectedDefinitionList = selectedDefinitionList;
            this.isSelect = isSelect;
        }
    }

The purpose of this wrapper class is to combine the value of a map and a checkbox. At the moment I've tried to view the data of my wrapper and it is working as expected, but my problem is that how will i show the data of my wrapper specifically the map in it to my visual force page(pageblockTable). I've made something like this :

<apex:pageBlock > 
<apex:pageBlockTable value="{!AllObjectFieldMap}" var="field" styleClass="table table-striped">
<apex:column value="{!field.selectedDefinitionList}" headerValue="Salesforce Field"/>
</apex:pageBlockTable> 
</apex:pageBlock> 

But I cannot see those data inside my map. I think I am lacking something. Please help thank you...

3
  • did you got solution. Commented Feb 3, 2016 at 9:02
  • 1
    @Tushar Sharma Sorry a late reply. Actually I've find a way to fix this problem. But thank you for helping. I've vote up your answer.thank you.
    – Hope
    Commented Feb 4, 2016 at 8:30
  • glad to know you find the answer. Commented Feb 4, 2016 at 9:22

2 Answers 2

1

for display data from map you need to use dynamic binding. First need to get the key then fetch the record and iterate. you can read this blog post. something like this

              <apex:pageBlockTable value="{!accountsMap[selectedKey]}" var="acc">
                   <apex:column value="{!acc.name}"/>
                   <apex:column value="{!acc.BillingStreet}"/>
                   <apex:column value="{!acc.BillingCity}"/>
                   <apex:column value="{!acc.BillingPostalCode}"/>
                </apex:pageBlockTable>
0

Below code can be used as an example to use Maps inside a visualforce page.

<apex:pageBlockTable value="{!MyMap}" var="M">  
 <apex:repeat value="{!MyMap[M]}" var="temp">  
  <apex:column value="{!temp.Test_Curr__c}" />  
 </apex:repeat>  
</apex:pageBlockTable> 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .