Salesforce LWC: Generic Lightning Datatable using Lightning Web Component
Today in this blog we will go though generic Lightning Data Table using Lightning Web Component. Using below code user can show data of any object in Salesforce Org. Below is the HTML code where we have used lightning-datatable standard lightning web component. In this component we are passing two values. 1. columns: List of columns which needs to be added in table. 2. finalData: this is the list of data which needs to be displayed. 1 2 3 4 5 6 <template> <div style= "height: 300px;" > <lightning -datatable key-field= "Id" data= {finalData} columns= {columns} hide-checkbox-column= true > < /lightning-datatable> </div> </template> Now in Java Script file we need to handle the data which will be sent by its parent component. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 import { LightningElement, api, tra...