+ Start a Discussion
smagee13smagee13 

Trying to get VF page to list a set of related records - APEX help needed

Newbe so please bare with me.

 

I have a custom object called Projects_ka__c that holds project information.  Each project may have a set of cases associated to them.  I have created a relationship from the cases object to the project objects and all is well.

 

What I am trying to do is extend the projects standard controler to display a list of related cases in a VF page, list style so that I can make quick edites and updates to the cases from the projects page

 

I have created a VF page as such

 

<apex:page standardController="project_ka__c"    extensions="ProjCase">
    <apex:form>
        <apex:pageBlock>
            <apex:pageBlockSection title="Projects Cases">
                <apex:dataTable value="{!CaseRecords}" var="CC"
                    styleClass="list">
                    <apex:column value="{!CC.ID}" />
                    <apex:column headerValue="Subject">
                        <apex:inputField value="{!CC.Subject}" />
                    </apex:column>
                    <apex:column headerValue="Due Date">
                        <apex:inputField value="{!CC.Date_Du__c}" />
                    </apex:column>
                </apex:dataTable>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
   

 

And an associated class/method

 

public class ProjCase {
  Project_KA__c myProject;
  List<Case> relatedCases;
  private final Project_ka__c projObj;
  public ProjCase(ApexPages.StandardController controller) {
    this.projObj = (Project_ka__c)controller.getRecord();
  }

  public Project_ka__c[] getCaseRecords() {

    case[] relatedCases =
      [select Id, Subject,Date_Du__c from Case where Project__c = :myProject.Id];
}
}
   

 

Two issues I seem to be facing (becides my lack of knowledge of Apex/java codeing)

 

1.  How do I ensure that the ProjCase class is using the current project record

2.  When referencing this extension on the VF page, Im receiveng the following error.

 
Save error: Unknown constructor 'ProjCase.ProjCase(ApexPages.StandardController controller)'   
 

 

Any tips, code samples, or advise is welcolmed