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...

  • did you got solution. – Tushar Sharma Feb 3 '16 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 Feb 4 '16 at 8:30
  • glad to know you find the answer. – Tushar Sharma Feb 4 '16 at 9:22
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> 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.