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
RajnRajn 

how to display accounts and contacts in grid view using lightning not vf pages

Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Rajn,

May I suggest you please refer the below code.
<apex:page standardController="Account">
    <apex:form >
        <apex:pageBlock title="List of Contacts" tabStyle="Parent__c">
            <apex:pageBlockTable value="{!Account.Contacts}" var="con">
                <apex:column value="{!con.Name}"/>
                <apex:column value="{!con.Title}"/>
                <apex:column value="{!con.Email}"/>
                <apex:column value="{!con.Phone}"/>
            </apex:pageBlockTable>
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="New Contact"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
        <br/>
        <br/>
        <apex:dataTable value="{!Account.Contacts}" var="con" border="1" cellpadding="5" cellspacing="4" bgcolor="lightblue">
            <apex:column value="{!con.Name}">
                <apex:facet name="header">Name</apex:facet>
            </apex:column>
            <apex:column value="{!con.Title}">
                <apex:facet name="header">Title</apex:facet>
            </apex:column>
            <apex:column value="{!con.Email}">
                <apex:facet name="header">Email</apex:facet>
            </apex:column>
            <apex:column value="{!con.Phone}">
                <apex:facet name="header">Phone</apex:facet>
            </apex:column>
        </apex:dataTable>
        <br/>
        <br/>
        <apex:repeat value="{!Account.Contacts}" var="con">
            <apex:outputLabel >{!con.Name}</apex:outputLabel> &nbsp;&nbsp;
            <apex:outputLabel >{!con.Title}</apex:outputLabel> &nbsp;&nbsp;
            <apex:outputLabel >{!con.Email}</apex:outputLabel> &nbsp;&nbsp;
            <apex:outputLabel >{!con.Phone}</apex:outputLabel> <br/>
        </apex:repeat>
    </apex:form>
</apex:page>

Please refer the below link for reference. hope it helps.

Please mark it as best answer if the information is informative.

Thanks
Rahul Kumar

 
Naveen KNNaveen KN
Hi Rahul, Question says displaying data in the lightning component but i can see the code mentioned is for visualforce page. Is the above mentioned code is supported for lightning component?
Naveen KNNaveen KN
Detailed steps to add a contacts grid view in the lightning component are shown in this video - https://www.youtube.com/watch?v=c4aQ5iK_-hI
RajnRajn
Hi naveen ,i want to add new,save and checkboxes and delete buttons for contact.plz help with link