I understand that this needs to be done using the infamous wrapper class, but for some reason I am not able to get it to work. Any help would be great.
Goal: Display multiple List<String>
as columns.
Something like this:
I would like to use pageblockTable to accomplish this (or perhaps a pageblockTable within a pageblockTable).
I am storing each column data in a List<String>
and it does NOT have a fixed number of entries. Each such List<String>
needs to repeat as columns for as many years as specified by user input.
public class Summary{
public List<String> summary_list {get; set;}
public Summary(List<String> s){
summary_list = s;
}
}
public List<Summary> summary_list_wrap {get; set;}
public List<String> items_in_column {get; set;}
public void build_Table(){
//populating the data here - which is working as per the screenshot below
}
The values of summary_block_wrap look like this when printed using the below code:
<apex:pageblockTable value="{!summary_list_wrap}" var="slw">
<apex:column value="{!slw}"/>
</apex:pageblockTable>
How do I tweak my visualforce page to match the desired layout?
EDIT: After implementing the answer suggested by Ashwani, the output looks like below. How can we format the table to remove the spacing between the columns and trim the column widths?