1

私はクラスを持っています

public with sharing class CAccountRep {
string sageAccountNo {get;set;}
string clientName {get;set;}
string name {get;set;}
integer noofdays {get;set;}
string billableUnits {get;set;}
decimal dailyChargeRate {get;set;}
string nominalCode {get;set;}
string practice {get;set;}
string taxFlag {get;set;}
string ProjectId {get;set;}
string PONumber {get;set;}

public CAccountRep(String CrSageAc,String CrClientN,string CrName,integer Crnoofdays,string crbillableunits,decimal CrDecimalChargeRate,string crNominalCode,string CrPractice, String CrTaxFlag,String CrProjectId, String CrPONumber)
{
    sageAccountNo=CrSageAc;
    clientName=CrClientN;
    name=CrName;
    noofdays=Crnoofdays;
    billableUnits=crbillableunits;
    dailyChargeRate=CrDecimalChargeRate;
    nominalCode=crNominalCode;
    practice=CrPractice;
    taxFlag=CrTaxFlag;
    ProjectId=CrProjectId;
    PONumber=CrPONumber;

}

    }

このクラスのオブジェクトを作成し、パラメータをこのクラスに渡します

   public List<CAccountRep> AR { get;set; }

   public list<CAccountRep> getAR()
   {   
    if(AR!= null)
        return AR ;
    else return null;
   }

   Using the follwing code to create the object of the class

     CAccountRep CRep=new CAccountRep(projectList[0].Sage_Account_Number__c,projectList[0].Client_Name__c, Cname,enoOfBillableDays,projectList[0].BillableUnits__c,AssConlist[0].Daily_Charge_Rate_of_Consultant__c,AssConlist[0].Nominal_Code__c,projectList[0].C85_Practice__c,projectList[0].Tax_Flag__c,projectList[0].Project_ID__c,projectList[0].PO_Number__c);

     AR.add(CRep);

VF ページで、リスト AR の内容を表示しようとしています。

しかし、VF ページの保存中にエラー Unknown Property CAccountRep.ProjectId が表示されます。

<table id="tableRep">
   <apex:repeat id="tc" value="{!AR}" var="TCrep">
   <tr>

   <td>{!TCrep.ProjectId}</td>
   </tr>
   </apex:repeat>
   </table>

{!TCrep} を与えるだけで、このような出力を得ることができます

CAccountRep:[PONumber=null, ProjectId=C85_JPMC1 _A-0083, billableUnits=null, clientName=001A000000YJFhdIAH, dailyChargeRate=null, name=Change Order 10002011-09-05 to 2011-10-10 : 0 null, nominalCode=null, noofdays=0, practice=Administration, sageAccountNo=null, taxFlag=null]
CAccountRep:[PONumber=null, ProjectId=C85_BBCWW _A-0084, billableUnits=null, clientName=001A000000cwgIlIAI, dailyChargeRate=null, name=Secure Desktop v012011-09-05 to 2011-10-10 : 0 null, nominalCode=null, noofdays=0, practice=null, sageAccountNo=null, taxFlag=null]
CAccountRep:[PONumber=null, ProjectId=C85_JPMC1 _A-0083, billableUnits=null, clientName=001A000000YJFhdIAH, dailyChargeRate=null, name=Change Order 10002011-09-05 to 2011-10-10 : 0 null, nominalCode=null, noofdays=0, practice=Administration, sageAccountNo=null, taxFlag=null]

正しく表示する方法についてのアイデアはありますか?

4

1 に答える 1

2

コンパイラは混乱していると思います。これは、意見に2つのパブリックゲッターがあるためです。つまり、これらの行の両方です。

public List<CAccountRep> AR { get;} // just removed set; for now

public list<CAccountRep> getAR()

ページで次の構文を使用すると、Visualforce ページから呼び出されます。

{!AR}

代わりにこれを試してください:

public List<CAccountRep> AR { get{
    return AR ; // if AR is null it returns null so the if statement was redundant

}set; }

getAR() メソッドを削除します。また、公開したいクラスメンバー変数をマークする必要があります。

public string ProjectId {get;set;}
于 2011-10-03T15:06:39.157 に答える