Last active
August 14, 2016 05:07
-
-
Save msrivastav13/b48f3cdf22040a018628b683b8fb9a61 to your computer and use it in GitHub Desktop.
Simple class to fetch data from SFDC Account Table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class AccountTest{ | |
@AuraEnabled | |
public static list<Account> getlstacc(){ | |
return [Select Id , Name , NumberofLocations__c from Account order by NumberofLocations__c limit 10]; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component controller="AccountTest" access="global"> | |
<aura:handler name="init" action="{!c.fetchAccounts}" value="{!this}" /> | |
<aura:attribute name="accounts" type="Account[]" /> | |
<ul> | |
<aura:iteration items="{!v.accounts}" var="account"> | |
<li > <h3>{!account.name}</h3> </li> | |
<li > <h3>{!account.NumberofLocations__c}</h3> </li> | |
</aura:iteration> | |
</ul> | |
</aura:component> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
fetchAccounts : function(component, event, helper) { | |
var action = component.get("c.getlstacc "); | |
action.setCallback(this, function(data) { | |
component.set("v.accounts", data.getReturnValue()); | |
}); | |
$A.enqueueAction(action); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment