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
Jonathan Wolff 7Jonathan Wolff 7 

How do fix code for displaying Apex class field in Component

Hello,
I want to display the List "rows" from my Apex Class in my component. I have no idea how to manage it. Could you help me fixing my component and controller I have. I tried a lot, but i get errors every time:

Component:
 
<aura:component controller="ApexActivityWrapper" implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" access="global">  
   
    <aura:attribute name="recordId" type="Id" />    
    <aura:attribute name="rows" type="Row[]"/>
    <aura:attribute name="RowList" type="List"/>
      <aura:handler name="init" value="{!this}" action="{!c.doInIt}"/>
   	
  
     <p align="center" class="slds-text-heading_large ">Task List</p>
    <table class="slds-table slds-table_cell-buffer slds-table_bordered slds-table_striped">
     <thead>
       <tr class="slds-line-height_reset">
        <th class="" scope="col">
       <div class="slds-truncate" >
        Row Subject
        </div>
         </th> 
         </tr>
        </thead>
        <tbody>
         <tr class="slds-hint-parent">
         <th data-label="" scope="row">
          <div class="slds-truncate" >
          
           <aura:iteration items="{!v.rows}" var="row">
            <p>{!row.Subject}</p><br/>
            </aura:iteration>
             </div>
              </th>
              </tr>
        </tbody>
    </table>
   
    <br/>
    <br/>
</aura:component>

Controller:
 
({
     doInIt : function(component, event, helper) {

        component.set("v.RowList", response.rows);  
    
    
        var action = component.get("c.rows");
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){
                   
           
                });
                component.set("v.RowList", response.rows);
            }
        });
        $A.enqueueAction(action);

}

APEX:
 
public Class ApexActivityWrapper {
   
    private Contact c;
    public List<Row> rows {get; set;}
    public Class Row implements Comparable {
        public String Subject {get; set;}
        public Datetime ActivityDate {get; set;}
        Row(String Subject, Datetime ActivityDate) {
            this.Subject = subject;
            this.ActivityDate = ActivityDate;
        }
        public Integer compareTo(Object o) {
            Row that = (Row) o;
            if (that.ActivityDate < this.ActivityDate) return 1;
            else if (that.ActivityDate > this.ActivityDate) return -1;
            else return 0;
        }
    }
    public ApexActivityWrapper () {
        rows = new List<Row>();
        for (Event evt : [
                SELECT Subject, ActivityDate FROM Event ORDER BY ActivityDate LIMIT 10
                ]) {
            rows.add(new Row(evt.Subject, evt.ActivityDate));
        }
        for (Task tsk: [
                SELECT Subject, ActivityDate FROM Task ORDER BY ActivityDate LIMIT 10
                ]) {
            rows.add(new Row(tsk.Subject, tsk.ActivityDate));
        }
        rows.sort();
        system.debug('ROWS' + rows);
    }
  
}

​​​​​​​​​​​​​​