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 implements="force:appHostable,flexipage:availableForAllPageTypes" | |
access="global" | |
controller="AccountController"> | |
<aura:attribute name="data" type="Object"/> | |
<aura:attribute name="columns" type="List"/> | |
<aura:attribute name="recordId" type="String"/> | |
<aura:attribute name="pageNumber" type="Integer" default="1"/> | |
<aura:attribute name="pageSize" type="Integer" default="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
({ | |
/* | |
* This finction defined column header | |
* and calls getAccounts helper method for column data | |
* editable:'true' will make the column editable | |
* */ | |
doInit : function(component, event, helper) { | |
component.set('v.columns', [ | |
{label: 'Name', fieldName: 'Name', type: 'text', | |
actions:[ |
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
({ | |
getAccounts : function(component, helper) { | |
var action = component.get("c.getAccountsWithOffset"); | |
action.setStorable(); | |
var pageSize = component.get("v.pageSize").toString(); | |
var pageNumber = component.get("v.pageNumber").toString(); | |
action.setParams({ | |
'pageSize' : pageSize, | |
'pageNumber' : pageNumber |
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 class AccountController { | |
@AuraEnabled | |
public static List<Account> getAccountsWithOffset(String pageSize, String pageNumber){ | |
Integer ps = Integer.valueOf(pageSize); | |
Integer pn = Integer.valueOf(pageNumber)-1; | |
List<Account> accounts = [SELECT | |
Id, Name, Phone, Rating, My_Custom_Field__c, Active__c | |
FROM Account LIMIT :Integer.valueOf(ps) OFFSET :(ps*pn)]; | |
return accounts; |
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 class AuraIfTester | |
{ | |
/** | |
* Function to get all AuraIFTester records | |
* */ | |
@AuraEnabled | |
public static List<AuraIfTester__c> getRecords() | |
{ | |
return [SELECT | |
Id, //Record ID |
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 implements="force:appHostable,flexipage:availableForAllPageTypes" | |
controller="AuraIfTester" | |
access="global" > | |
<aura:attribute name="records" type="list" /> | |
<aura:handler name="init" value="{!this}" action="{!c.doInit}" /> | |
<table style="border-color: grey; float: left;" border="1" cellspacing="4" cellpadding="4"> | |
<tbody> | |
<aura:iteration items="{!v.records}" var="item"> | |
<!-- Check if row needs to shown --> | |
<aura:if isTrue="{!item.Show_Me__c}"> |
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
({ | |
doInit : function(component, event, helper) { | |
helper.onInit(component, event, helper); | |
} | |
}) |
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
({ | |
/** | |
* Retrieve the data from server | |
* */ | |
onInit : function(component, event, helper) { | |
var action = component.get("c.getRecords"); | |
action.setStorable(); | |
action.setCallback(this,function(response) { | |
console.log('Response Time: '+((new Date().getTime())-requestInitiatedTime)); | |
var state = response.getState(); |
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 implements="force:appHostable,flexipage:availableForAllPageTypes" | |
controller="AuraIfTester" | |
access="global" > | |
<aura:attribute name="records" type="list" /> | |
<aura:handler name="init" value="{!this}" action="{!c.doInit}" /> | |
<table style="border-color: grey; float: left;" border="1" cellspacing="4" cellpadding="4"> | |
<tbody> | |
<aura:iteration items="{!v.records}" var="item"> | |
<tr> | |
<td>{!item.Name}</td> |
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
({ | |
doInit : function(component, event, helper) { | |
helper.onInit(component, event, helper); | |
} | |
}) |