1

I'm creating lightning component to display data in nice format in a table. But data is not coming in table format.

Below is my code:

Component:

<aura:component controller="ContactsController">
    <ltng:require styles="{!$Resource.SLDS090}"/>
    <head>
        <title>This will display contacts whose's birthday is today.</title>
    </head>
    <aura:attribute name="contacts" type="List" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <!-- <div class="container">-->
    <div class="slds"> 

    <table class="slds-table slds-table--bordered slds-table--striped">
        <thead>
            <tr>
                <th scope="col"><span class="slds-truncate">Date</span></th>
                <th scope="col"><span class="slds-truncate">Contact Name</span></th>
            </tr>
        </thead>
        <tbody>
            <aura:iteration items="{!v.contacts}" var="contact">
                <tr>
                    <td>{!contact.Birthdate}</td>
                    <td>{!contact.Name}</td>
                </tr>
            </aura:iteration>
        </tbody>
    </table>
        </div>
</aura:component>

Below is my result:

enter image description here

2
  • When you say "data is not coming in table format" what do you mean? Can you post the HTML markup generated by your above code?
    – dsharrison
    Commented Jun 23, 2016 at 16:29
  • Hi D.S. I have added the generated data format Commented Jun 23, 2016 at 16:34

1 Answer 1

6

I was able to reproduce the problem. Try including the stylesheets as mentioned below

 <ltng:require styles="{! $Resource.SLDS090 + '/assets/styles/salesforce-lightning-design-system.css'}"/>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .