function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NoamNoam 

Nested wrappers view in vf page

Hey,

So ive made those nested wrappers which work fine!

public class firstwrapper{
        public contact con {set;get;}
        public list <secondwrapper> second_list {set;get;}
        public firstwrapper(contact con, list <secondwrapper> second_list){
            this.con = con;
            this.second_list = second_list;
        }
    }
public class secondwrapper{
        decimal counter {set;get;}
        integer num {set;get;}
        decimal average {set;get;}
        sObject__c object_name {set;get;}
        public secondwrapper(decimal counter, integer num, decimal averege, sObject__c object_name){
            this.counter  = counter ;
            this.num = num;
            this.average = average;
            this.object_name = object_name;
        }
    }
  So, the code works good.  
    
My problem is how to display them in my vf page.
 Im trying:

<apex:pageBlock title="Title">
         <apex:pageblocktable value="{!firstwrapper}" var="first">
                <apex:column headervalue="Name">
                    <apex:outputtext value="{!first.contact.Name}"/>
                </apex:column>
                <apex:column  headerClass="ct">
                    <apex:facet name="Facet Name">
                    </apex:facet>
                    <apex:pageblocktable value="{!first.second_list}" var="sec">
                        <apex:column headervalue="fieldname">
                            <apex:outputtext value="{!sec.object_name.sobjectfield}"/>
                        </apex:column>
                        <apex:column headervalue="counter" value="{!sec.counter}"/>
                        <apex:column headervalue="num" value="{!sec.num}"/>
                        <apex:column headervalue="average" value="{!sec.average}"/> 
                     </apex:pageblocktable> 
               </apex:column>
        </apex:pageblocktable>
 </apex:pageBlock>  

but cannot even compile. while i save im getting:

"Error: Unknown property '<classname>.secondwrapper.object_name'"

Any suggestions???

Thanks in advanced
BalajiRanganathanBalajiRanganathan
you have defined the wrapper classes. but did you define the properties in the VF contorller using the Wrapper classes?
define the properties and then use that property name.
 
public class controller {
  
public controller.firstwrapper first {get;set}

 public class firstwrapper{
}  
}|

 
NoamNoam

BalajiRanganathan  - Thank you for your answer, ive tryed it. still not working...