• Akhil Kulkarni
  • 0 Points
  • Member since 2015

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1
Hi all,
I am trying to build lightning components and I want to access the properties of an Apex controller in the components to display certain data. When try to display the values like in Visualforce (with added @AuraEnabled), it does not work. When I place the properties inside an inner class and create a method that has a return type as that inner class, then when I return a list of that class I can see the data. Bellow is the code which displays data, but I want to use it without an inner class and extra method to get that data. If anybody can help please let me know.


public with sharing class EmployeeAvailability {
public static empAvailableInnerclass innerCList;
public class empAvailableInnerClass {
        public Decimal aetPerc {get;set;}
        public Integer totalEmployeesToday {get;set;}
        public Decimal budgetThisMonth {get;set;}
        public Decimal averageMargin {get;set;}
        public Object averageRate {get;set;}
        public Integer illnessToday {get;set;}
        public List<availableNextSixty> AvailableSixty{get;set;}
        public Date DateAfterTwoMonths {get;set;}

        public empAvailableInnerclass() {

    public static empAvailableInnerclass getEmployeesDailyStatus(){
        return innerCList;

JavaScript controller:
getFixedTable : function(cmp, event, helper) {
        var table = cmp.get("c.getEmployeesDailyStatus");
            var state = response.getState();
            if (state === "SUCCESS") {
            } else if (state === "ERROR") {
                alert('Error : ' + JSON.stringify(errors));

Lightning Component:
<aura:handler name="init" value="{!this}" action="{!c.getFixedTable}"/>
<aura:attribute name="tabTable" type="EmployeeAvailabilityLightning"/>

<table id="fixedTab">
                    <th>Total employees today : {!v.tabTable.totalEmployeesToday}</th>
                    <th>Budget this month : {!v.tabTable.budgetThisMonth}</th>
                    <th>Average Margin : {!v.tabTable.averageMargin} %</th>
                    <th>Available next 60 days : {!v.tabTable.AvailableSixty.size}</th>
                    <th>Employee hours available today : {!v.tabTable.aetPerc} %</th>
                    <th>Illness Today: {!v.tabTable.illnessToday}</th>