+ Start a Discussion
Sree SalesforceSree Salesforce 

i got a small issue regarding wrapper class(i.e Invalid type: displaywrapper ).

<apex:page standardController="opportunity" extensions="wrapperclass">
<apex:form >
  <apex:pageBlock >
   <apex:pageBlockTable value="{!oppdata}" var="v">
    <apex:column value="{!v.oppflag.name}"/>
    <apex:column value="{!v.oppflag.CloseDate}"/>
    <apex:column value="{!v.oppflag.Type}"/>
    <apex:column value="{!v.oppflag.StageName}"/>
    <apex:column value="{!v.oppflag.Amount}"/>
    <apex:column >
    <apex:inputCheckbox value="{!opp.oppflag}"/>
   </apex:pageBlockTable>
  </apex:pageBlock>
</apex:form>
</apex:page>


public class wrapperclass {

  public list<displaywrapper> oppdata{get;set;}

    public wrapperclass(ApexPages.StandardController controller) {
     if(oppdata == null){
    
     oppdata=new list<displaywrapper>();
     for(opportunity o1:[select id,name,closedate,type,stagename,amount from opportunity]);
     oppdata.add(new displaywrapper(o1,true));
     }
    }
    public class diplaywrapper{
     public opportunity oppflag{get;set;}
     public boolean boo{get;set;}
    
     public diplaywrapper(opportunity opp,boolean b1)
     {
      opp=oppflag;
      b1=boo;
      }
}
   }
Best Answer chosen by Sree Salesforce
praveen murugesanpraveen murugesan
Hi Sri,

Pls change the code lik this,

public class wrapperclass 
{
    public list<displaywrapper> oppdata{get;set;}

    public wrapperclass(ApexPages.StandardController controller)
    {
        if(oppdata == null)
        {    
            oppdata = new list<displaywrapper>();          
            for(Opportunity o1 : [select id,name,closedate,type,stagename,amount from Opportunity])
            {
                oppdata.add(new displaywrapper(o1,true));
            }
        }
    }
    public class displaywrapper
    {
        public opportunity oppflag{get;set;}
        public boolean boo{get;set;}
        
        public displaywrapper(opportunity opp,boolean b1)
        {
            //opp=oppflag;
            oppflag=opp;
            //b1=boo;
            boo=b1;
        }
    }
}
<apex:page standardController="opportunity" extensions="wrapperclass">
<apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!oppdata}" var="v">
            <apex:column value="{!v.oppflag.name}"/>
            <apex:column value="{!v.oppflag.CloseDate}"/>
            <apex:column value="{!v.oppflag.Type}"/>
            <apex:column value="{!v.oppflag.StageName}"/>
            <apex:column value="{!v.oppflag.Amount}"/>
            <apex:column >
            <apex:inputCheckbox value="{!v.oppflag}"/>
            </apex:column>
       </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>

Mark it as best answer if its helps.

Thanks,

Praveen Murugesan

All Answers

shiv@SFDCshiv@SFDC
You are doing spelling mistake

// here you have written display
oppdata=new list<displaywrapper>()



// but here you have written diplay
public class diplaywrapper{



Sree SalesforceSree Salesforce
i got variable does not exist error o1.unable to find

praveen murugesanpraveen murugesan
Hi Sri,

Pls change the code lik this,

public class wrapperclass 
{
    public list<displaywrapper> oppdata{get;set;}

    public wrapperclass(ApexPages.StandardController controller)
    {
        if(oppdata == null)
        {    
            oppdata = new list<displaywrapper>();          
            for(Opportunity o1 : [select id,name,closedate,type,stagename,amount from Opportunity])
            {
                oppdata.add(new displaywrapper(o1,true));
            }
        }
    }
    public class displaywrapper
    {
        public opportunity oppflag{get;set;}
        public boolean boo{get;set;}
        
        public displaywrapper(opportunity opp,boolean b1)
        {
            //opp=oppflag;
            oppflag=opp;
            //b1=boo;
            boo=b1;
        }
    }
}
<apex:page standardController="opportunity" extensions="wrapperclass">
<apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!oppdata}" var="v">
            <apex:column value="{!v.oppflag.name}"/>
            <apex:column value="{!v.oppflag.CloseDate}"/>
            <apex:column value="{!v.oppflag.Type}"/>
            <apex:column value="{!v.oppflag.StageName}"/>
            <apex:column value="{!v.oppflag.Amount}"/>
            <apex:column >
            <apex:inputCheckbox value="{!v.oppflag}"/>
            </apex:column>
       </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>

Mark it as best answer if its helps.

Thanks,

Praveen Murugesan

This was selected as the best answer