Skip to content

Instantly share code, notes, and snippets.

@choudharymanish8585
Last active February 17, 2019 22:33
Show Gist options
  • Save choudharymanish8585/b5a393036bedb0b94847c4bde1360650 to your computer and use it in GitHub Desktop.
Save choudharymanish8585/b5a393036bedb0b94847c4bde1360650 to your computer and use it in GitHub Desktop.
<aura:component controller="CarTypeSearch"
implements="force:appHostable,flexipage:availableForRecordHome,force:hasRecordId"
extends="c:Base">
<!-- Attribute to controle visibility of New button -->
<aura:attribute name="showNew" type="boolean" />
<aura:attribute name="carTypes" type="Car_Type__c[]"/>
<aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
<!-- This event will be fired when user will click on
search button and will selected carTypeId-->
<aura:registerEvent name="searchFormSubmit" type="c:SearchFormSubmitEvent" />
<lightning:layout horizontalAlign="center">
<lightning:layoutItem>
<lightning:select name='selectItem' aura:id="carType" label='All Types'
variant="label-hidden" value="">
<option value="" text="All Types" />
<aura:iteration items="{!v.carTypes}" var="carType">
<option value="{!carType.Id}" text="{!carType.Name}" />
</aura:iteration>
</lightning:select>
</lightning:layoutItem>
<lightning:layoutItem padding="around-medium">
<lightning:button label="Search" variant="brand" onclick="{!c.onFormSubmit}"/>
<!-- display new button on availibity -->
<aura:if isTrue="{!v.showNew}">
<lightning:button variant='neutral' label='New' onclick="{!c.createRecord}"/>
</aura:if>
</lightning:layoutItem>
</lightning:layout>
</aura:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment