Skip to content

Instantly share code, notes, and snippets.

@choudharymanish8585
Last active June 28, 2018 09:55
Show Gist options
  • Save choudharymanish8585/81c6196b8d4929cc56a71849c1a50f08 to your computer and use it in GitHub Desktop.
Save choudharymanish8585/81c6196b8d4929cc56a71849c1a50f08 to your computer and use it in GitHub Desktop.
({
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();
if (state === "SUCCESS") {
console.log('Response Time: '+((new Date().getTime())-requestInitiatedTime));
if(response.getReturnValue().length < component.get("v.pageSize")){
component.set("v.isLastPage", true);
} else{
component.set("v.isLastPage", false);
}
component.set("v.resultSize", response.getReturnValue().length);
component.set("v.data", response.getReturnValue());
}
});
var requestInitiatedTime = new Date().getTime();
$A.enqueueAction(action);
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment