Skip to content

Instantly share code, notes, and snippets.

@sfmishra
Last active April 3, 2019 10:31
Show Gist options
  • Save sfmishra/f097ffa4b76b1739521590186a233a24 to your computer and use it in GitHub Desktop.
Save sfmishra/f097ffa4b76b1739521590186a233a24 to your computer and use it in GitHub Desktop.
<aura:component controller="searchContactController">
<aura:attribute name="result" type="List" description="list of seached contacts"/>
<aura:attribute name="searchTxt" type="String" description="use for searching contacts"/>
<div class="slds-m-around_medium">
<lightning:layout>
<lightning:layoutItem size="3" padding="around-small">
<lightning:input value="{!v.searchTxt}"
required="true"
placeholder="search Contacts"
aura:id="searchContact"
label="Contact Name"/>
</lightning:layoutItem>
<lightning:layoutItem size="2" padding="around-small">
<lightning:button onclick="{!c.Search}"
variant="brand"
label="search"
iconName="utility:search"/>
</lightning:layoutItem>
</lightning:layout>
<table class="slds-table slds-table_bordered slds-table_cell-buffer">
<thead>
<tr class="slds-text-title_caps">
<th scope="col">
<div class="slds-truncate" title="S.no">S.no</div>
</th>
<th scope="col">
<div class="slds-truncate" title="Contact Name">Contact Name</div>
</th>
</tr>
</thead>
<tbody>
<aura:iteration items="{!v.result}" var="contact" indexVar="count">
<tr>
<td>
<div class="slds-truncate">{!count + 1}</div>
</td>
<td>
<div class="slds-truncate">{!contact.Name}</div>
</td>
</tr>
</aura:iteration>
</tbody>
</table>
</div>
</aura:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment