function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Prabakaran ArivazhaganPrabakaran Arivazhagan 

Create "Contact List" LWC Component. Show list of all Contacts with these columns – Name (Including Salutation, First Name, Last Name), Account Name, Email, Phone, Mailing Address

I am completly new to LWC  can anyone help me to find this resources regarding LWC functionality.
Best Answer chosen by Prabakaran Arivazhagan
CharuDuttCharuDutt
Please Close Your Query By Marking It As Best Answer If It Helps So It Also Help Other In Future

All Answers

CharuDuttCharuDutt
Hii Prabhakaran
Try Below Code
Apex:
public class ContactRecords {
  @AuraEnabled(cacheable=true)
    public static List<contact> fetchCon (){
        List<contact> query= [select id,Name,Account.name,Email,Phone,MailingAddress from contact Where AccountId != Null];
         return query;
    }  
}


<template>
    <lightning-card title='Custom Table' icon-name="custom:custom11">
        <table class="slds-table slds-table_cell-buffer slds-table_bordered">
            <thead>
                <tr class="slds-line-height_reset">
                  <th class="" scope="col">
                    <div class="slds-truncate" title="Contact Name">Contact Name</div>
                  </th>
                  <th class="" scope="col">
                    <div class="slds-truncate" title="Account Name">Account Name</div>
                  </th>
                  <th class="" scope="col">
                    <div class="slds-truncate" title="Type">Email</div>
                  </th>
                  <th class="" scope="col">
                    <div class="slds-truncate" title="Rating">Phone</div>
                  </th>
                  <th class="" scope="col">
                    <div class="slds-truncate" title="Phone">Mailing Address</div>
                  </th>
                </tr>
              </thead>
              <tbody>
                <template for:each={records} for:item ='record'>
                <tr class="" key = {record.Id}>
                        <td data-label="Account Name">
                            <div class="slds-cell-wrap"><a href="javascript:void(0);">{record.Salutation}. {record.Name}</a></div>
                        </td>
                        <td data-label="Parent Account">
                            <div class="slds-cell-wrap"><a href="javascript:void(0);">{record.Account.Name}</a></div>
                        </td>
                        <td data-label="Industry">
                            <div class="slds-cell-wrap">{record.Email}</div>
                        </td>
                        <td data-label="Rating">
                            <div class="slds-cell-wrap">{record.Phone}</div>
                        </td>
                        <td data-label="Phone">
                            <div class="slds-cell-wrap">{record.Mailing Address}</div>
                        </td>
                </tr>
                </template>
            </tbody>
        </table>
    </lightning-card>
</template>

import { LightningElement,wire } from 'lwc';
import fetchConfrom '@salesforce/apex/ContactRecords.fetchCon';
export default class TabInAccordian extends LightningElement {
    data1 = [];
    wiredActivities;
    records = '';
    error;
    @wire(fetchCon,{
        }
    )
    wiredCases(value){
        this.wiredActivities = value;
        const { data, error } = value;
    
    if(data){
        let dataEditing = JSON.parse(JSON.stringify(data));
        console.log(JSON.stringify(dataEditing));
        this.records = dataEditing.length;
        this.data1 = dataEditing;
        
    }else if(error){
        this.error = error;
    }
    
}
}
Please Mark It As Best Asnwer If  It Helps
Thank You!
Prabakaran ArivazhaganPrabakaran Arivazhagan
Thanks for the help sir. I forgot to mention default sorting should be on name sir.
CharuDuttCharuDutt
Please Close Your Query By Marking It As Best Answer If It Helps So It Also Help Other In Future
Prabakaran ArivazhaganPrabakaran Arivazhagan
ok sir sure Thanks
 
CharuDuttCharuDutt
Please Close Your Query By Marking It As Best Answer If It Helps So It Also Help Other In Future
This was selected as the best answer