Find your content:

Search form

You are here

How to display List in Visual force page?

 
Share

In controller I will get the data as List<List<String>>. How can I display it on Visual force page?

And that List<List<String>> is populated based on user input(Checkbox values).

If it's just List<String> then I could able to display them using datalist

List<String> alist;

then I can use this to display them

<apex:dataList value="{!alist}" var="c">
    {!c}                        
</apex:dataList>

Attribution to: Akash Nidhi P S

Possible Suggestion/Solution #1

If you have a list of list "List < List < String>>" you will need to do something like :

<apex:repeat value="{!alist}" var="l">
    <apex:dataList value="{!l}" var="c">
          {!c}
    </apex:dataList>
</apex:repeat>

Attribution to: Cloud Ninja

Possible Suggestion/Solution #2

You can show list of list by any below approach

1) first approach

    <apex:repeat value="{!ListOfList}" var="List">
     <apex:repeat value="{!list}" var="item">
      {!item}
     </apex:repeat>
    </apex:repeat>

2) Second approach
     (this approach use when we are creating many tables on layout 
    <apex:repeat  value="{!ListOfList}" var="List">
     <apex:pageblocktable value="{!list}" var="item">
      {!item}
    </apex:pageBlockTable>
     </apex:repeat>

Attribution to: D-Horse
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/33415

My Block Status

My Block Content