Salesforce Lightning Aura Component

Salesforce

Simple Pagination Example in Lightning Component

Sample Code: Component: <aura:component implements="force:appHostable" controller="OpportunitySearchController"> <aura:attribute name="oppty" type="Opportunity" default="{ 'sobjectType': 'Opportunity'}"/> <aura:attribute name="columns" type="List"/> <aura:attribute name="opportunityList" type="Opportunity[]"/> <aura:attribute name="PaginationList" type="Opportunity[]"/> <aura:attribute name="startPage" type="Integer" /> <aura:attribute name="endPage" type="Integer"/> <aura:attribute name="totalRecords" ....

Salesforce

Lighting Data Table Sorting Example

AccountList.cmp <aura:component controller="AccountListController"                 implements="flexipage:availableForAllPageTypes,lightning:actionOverride,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:appHostable" >          <aura:attribute type="Account[]" name="acctList"/>     <aura:attribute name="mycolumns" type="List"/>     <aura:attribute name="sortedBy" type="String" ....

Salesforce

lightning:fileUpload component example

Sample Code: Component: <aura:component implements="force:appHostable" > <lightning:fileUpload label="Attach receipt" name="fileUploader" multiple="true" accept=".pdf, .png" recordId="0016A00000MneVlQAJ" onuploadfinished="{!c.handleUploadFinished}" /> </aura:component> Controller: ({ handleUploadFinished: function (cmp, event) { var uploadedFiles = event.getParam("files"); alert("Files uploaded"); ....

Salesforce

lightning:datatable in Salesforce Lightning Component

AccountList.cmp: <aura:component controller="AccountListController" implements="flexipage:availableForAllPageTypes,lightning:actionOverride,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:appHostable" > <aura:attribute type="Account[]" name="acctList"/> <aura:attribute name="mycolumns" type="List"/> <aura:handler name="init" value="{!this}" action="{!c.fetchAccounts}"/> <lightning:datatable data="{! v.acctList }" columns="{! v.mycolumns }" keyField="id" hideCheckboxColumn="true"/> </aura:component> AccountListController.js ({ fetchAccounts : function(component, ....

Salesforce

force:navigateToURL example in Salesforce Lightning

force:navigateToURL can be used for Navigation in Salesforce Lightning. AccountList.cmp: <aura:component controller="AccountListController" implements="flexipage:availableForAllPageTypes,lightning:actionOverride,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:appHostable" > <aura:attribute type="Account[]" name="acctList"/> <aura:handler name="init" value="{!this}" action="{!c.fetchAccounts}"/> <table class="slds-table slds-table_bordered slds-table_cell-buffer"> <thead> <tr class="slds-text-title_caps"> <th scope="col"> ....

Salesforce

aura:iteration example in Salesforce Lightning Component

Sample App: <aura:application extends="force:slds"> <c:AccountList /> </aura:application> Lightning Aura Component: AccountList.cmp: <aura:component controller="AccountListController"> <aura:attribute type="Account[]" name="acctList"/> <aura:handler name="init" value="{!this}" action="{!c.fetchAccounts}"/> <table class="slds-table slds-table_bordered slds-table_cell-buffer"> <thead> <tr class="slds-text-title_caps"> <th scope="col"> <div ....