Posts

Showing posts with the label LWC

How to implement client side pagination in LWC ?

Image
In this article, we are going to see how to implement client side pagination in LWC. Let say you have got requirement to get contacts from apex controller and display it in a table. But the catch here is there are 100s of records and now you have got the task to implement pagination such that you can also control how many records can be shown in the table from component only. So let's begin 1.Let's say we have got apex controller as below : @AuraEnabled(cacheable=true) public static List getMContact(String uId){ List cList = new List (); system.debug('The user Id is '+uId); User ug = [Select Id,Contact.AccountId from User WHERE Id =: uId LIMIT 1]; if(ug != null){ cList = [Select Id,Name,Phone,BirthDate,Email,MobilePhone,Role__c,is_Active__c from Contact WHERE AccountId =: ug.Contact.AccountId]; } system.debug('the count is '+cList.size()); return cList; } 2. Now ...

Update Custom Fonts in Salesforce Experience/Community Site

Image
So we are going to see how we can update the custom fonts on Salesforce Experience Site. If we want to change the fonts, we have a set of fonts that are available in the community site that we can choose from. But in case if we want to get a new font style we can follow the process.   1. Download the .ttf file of the font that you want in your experience site.   2. Upload the file in the Static Resource. 3.   Then go to Setup > All Sites > Builder (of site in which font is to be added). 4.   Then select Themes as shown in the image below. 5.  Select the drop-down and the click on Edit CSS as shown below. 6.  Here enter the code as metioned below. 7.  Font-family is the alias name given to the font with the help of which we will select the custom font later. Then in the src :  url(‘/sfsites/c/resource/  will be as it. Then we will enter the name of static resource which we had created earlier and in the end we will e...