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
NishaCNishaC 

How to Access Wrapper class variable in VF page List

Hii,

        Can any one suggest me how i can use static list to access wrapper class variables in visualforce page 

MagulanDuraipandianMagulanDuraipandian

Apex Code:

public class a

{

     public w var {get;set}

//wrapper class

    public class w

    {

        public String str;

    }

}

 

Visualforce page:

<apex:outputText value="{!var.str}"/>

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

SFDC Blog

If this post is your solution, kindly mark this as the solution.

NishaCNishaC

thanks for your reply but i have already done this

 

global with sharing class DashPortalController{
public static List<CaseFailBean> listCaseFailBean{get;set;}

@RemoteAction
global static CaseFailBean[] loadCustomerServiceSuccessRate(String dateFrom){
listCaseFailBean= new List<CaseFailBean>();
CaseFailBean beanObj=new CaseFailBean(AccId,WasteColl,DaysColl,ServiceSuccessRate,ServiceFailureRate);
listCaseFailBean.add(beanObj);
}
global class CaseFailBean{
public String AccName{get;set;}
public String WasteName{get;set;}
public String DaysTotal{get;set;}
public Decimal totalCases{get;set;}
public Decimal totalServiceColl{get;set;}

public CaseFailBean(String Name,String WasteType,String TotalDays,Decimal ServiceSuccessRate,Decimal ServiceFailureRate){
this.AccName= Name;
this.WasteName= WasteType;
this.DaysTotal= TotalDays;
this.totalServiceColl=ServiceSuccessRate;
this.totalCases=ServiceFailureRate;
}

public CaseFailBean(){

}

}

==========================VisualForce Page====================
<apex:page controller="DashPortalController" readonly="true" contentType="application/vnd.ms-excel" language="en-US">
<apex:pageBlock >
<apex:pageBlockTable value="{!listCaseFailBean}" var="bl">
<apex:column headerValue="Account Name">
<apex:outputText value="{!bl.AccName}"/>
</apex:column>
<apex:column headerValue="Waste Name">
<apex:outputText value="{!bl.WasteName}"/>
</apex:column>
<apex:column headerValue="DaysTotal">
<apex:outputText value="{!bl.DaysTotal}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

 

the problem is, in VF page when i click export to csv then CSV file only shows Header name that i have used in 

<apex:column headerValue="">

but not showing the values 

MagulanDuraipandianMagulanDuraipandian

Dont use pageblock and other tags for export.... Thats y u r getting the error... think so... My suggestion is try without using tags

 

http://infallibletechie.blogspot.in/2012/08/export-using-apex-code-in-salesforce.html

 

Check this link...

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

SFDC Blog

If this post is your solution, kindly mark this as the solution.

NishaCNishaC

it is not showing the values but displays the header

like     Account Name                  Waste Type

 

 

Anil MeghnathiAnil Meghnathi

Hi

 

Your list listCaseFailBean is empty,because you have not call method loadCustomerServiceSuccessRate(String dateFrom).

Or you can simply create list in  the constructor of mail class as shown below

 

global with sharing class DashPortalController

{
public static List<CaseFailBean> listCaseFailBean{get;set;}

public DashPortalController()

{

CaseFailBean beanObj=new CaseFailBean("some","WasteColl","DaysColl",0,0);
listCaseFailBean.add(beanObj);
}

 

}

 

Try it and let me know whether it works or not??

Thanks

Anil

NishaCNishaC

i have declared CaseFailBean beanObj in @remoteaction, how can i call it in constructor  DashPortalController()

public DashPortalController()

{

}

 

 

Anil MeghnathiAnil Meghnathi

IF you dont need Remoteaction than use constructor otherwise call the  loadCustomerServiceSuccessRate(String dateFrom) from constructor.Try it.and let me know

 

global with sharing class DashPortalController

{
public static List<CaseFailBean> listCaseFailBean{get;set;}

public DashPortalController()

{

 loadCustomerServiceSuccessRate(anyData);
}

@RemoteAction

global static CaseFailBean[] loadCustomerServiceSuccessRate(String dateFrom){
listCaseFailBean= new List<CaseFailBean>();
CaseFailBean beanObj=new CaseFailBean("AccId","WasteColl","DaysColl",ServiceSuccessRate,ServiceFailureRate);
listCaseFailBean.add(beanObj);
}

}

 

NishaCNishaC

hii anil

              i have tried this but it is giving error: Attempt to De-refernce null object

 

public DashPortalController()

{

 loadCustomerServiceSuccessRate(anyData); // Giving Error
}

Anil MeghnathiAnil Meghnathi

Nisha

if its possible send me the full code of class and page.

 

NishaCNishaC

please check your private message