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"/> | |
<aura:attribute name="isLastPage" type="Boolean" default="false"/> |
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'}, | |
{label: 'Phone', fieldName: 'Phone', type: 'phone'}, |
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(); | |
action.setParams({ | |
'pageSize' : component.get("v.pageSize").toString(), | |
'pageNumber' : component.get("v.pageNumber").toString() | |
}); | |
action.setCallback(this,function(response) { | |
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
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)]; |
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="allData" type="List"/> | |
<aura:attribute name="currentPageNumber" 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'}, | |
{label: 'Phone', fieldName: 'Phone', type: 'phone'}, |
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.getLimitedAccounts"); | |
action.setStorable(); | |
action.setCallback(this,function(response) { | |
var state = response.getState(); | |
if (state === "SUCCESS") { | |
console.log('Response Time: '+((new Date().getTime())-requestInitiatedTime)); | |
component.set("v.totalPages", Math.ceil(response.getReturnValue().length/component.get("v.pageSize"))); | |
component.set("v.allData", response.getReturnValue()); |
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 .selected{ | |
color:orange; | |
} |
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> getLimitedAccounts(){ | |
List<Account> accounts = [SELECT | |
Id, Name, Phone, Rating, My_Custom_Field__c, Active__c | |
FROM Account ORDER BY CreatedDate LIMIT 2000]; | |
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 ListViewController { | |
@AuraEnabled | |
public static list<String> fetchListViews(String strObjName) { | |
list<String> lstListViews = new list<String>(); | |
if(strObjName != null && strObjName != ' ' && strObjName.length() != 0) { | |
list<ListView> lstViews = [Select Name,sobjectType From ListView where SobjectType =: strObjName]; | |
for(ListView iterator:lstViews) { | |
lstListViews.add(iterator.Name); | |
} |
OlderNewer