3

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>

2 Answers 2

5

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>
2
  • I am getting this Error: Literal value is required for attribute var in <apex:dataList> for var="{!c}" Apr 23, 2014 at 5:51
  • 1
    This should read <apex:dataList value="{!l}" var="c">
    – altius_rup
    Apr 23, 2014 at 5:54
1

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>

You must log in to answer this question.

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