Posts

New Way of Pagination

Image
   In salesforce there are 2 ways to achieve pagination. 1) Using StandardSetController (Limitation : To instantiate              StandardSetController we can query up to 10000 records using query     locator.   Querying more than 10000 records causes a LimitException to     be thrown.     However by passing list of more than 10000 records we can instantiate     StandardSetController, again holding more records in the List and instantiate StandardSetController can reach heap size. ) 2) Using OFFSET in SOQL query (Limitation : We can skip max 2000     records using OFFSET which means we cannot do pagination by using     OFFSET if the query skips more than 2000 records. Skipping more than     2000 records causes "Maximum SOQL offset allowed is 2000 error" . )         Here is a new way...

Dispalying Data Table in Lightning

Image
Lightning is revolutionary change in user interface of Salesforce. This post will be explaining how to use Lightning component to display data in table format by querying data from Sobject, how to use SLDS to format table and call server method from component controller. We have 4 code snippets here. 1. DataTable.cmp - Lightning component to display data. 2. DataTableController.js - Client side controller in Javascript. 3. DataTableController - Server side controller in Apex. 4  DataDisplay.app - Lightning application to where DataTable component will be used. ===================================================================================== 1)  DataTable.cmp <aura:component controller="DataTableController">     <ltng:require styles="{! $Resource.SLDS105 + '/assets/styles/salesforce-lightning-design-system.css'}"/>     <aura:attribute name="accountList" type="Account[]"/>     <aura:handler name="i...