appiphony / Strike-Components

Work smarter (not harder) with Salesforce Lightning Components
http://www.lightningstrike.io
BSD 2-Clause "Simplified" License
171 stars 119 forks source link

strike_lookup won't propagate onchange event #190

Open davidchengIC opened 6 years ago

davidchengIC commented 6 years ago

I need to detect an onchange event when using the strike_lookup component so I've wrapped it in a <div>, but it looks like the component does an event.stopPropagation so the event won't bubble up to the parent component.

<div id="mfrInput" onchange="{!c.refreshSGIList}">
    <c:strike_lookup label="Manufacturer"
            object="Account"
            searchField="Name"
            placeholder="Select a manufacturer"
            iconName="standard:account"
            order="Name"
            loadingMessage="Loading..."
            errorMessage="Invalid input"
            showRecentRecords="true"
            value="{!v.newTask.Manufacturer__c}" />
</div>
<aura:if isTrue="{!v.newTask.Manufacturer__c != null}">
    <c:getSGIList mfrId="{!v.newTask.Manufacturer__c}" year="2018" aura:id="SGIList" />
</aura:if>

Is there any workaround for this, or any plans to enable onchange for strike_lookup?

mrichmon12 commented 6 years ago

@davidchengIC I'm also looking for the ability to capture the onchange event. Were you able to find a workaround? @kevinberonilla is there a workaround for this, or should an enhancement be submitted?

davidchengIC commented 6 years ago

@mrichmon12 Unfortunately I couldn't find a workaround.

mrichmon12 commented 6 years ago

@davidchengIC I was able to work around this by creating a change event handler in my component for the value bound to the strike lookup. Hopefully this works in your situation as well.

Component
<aura:handler name="change" value="{!v.myAccount}" action="{!c.myActionHandler}"/>

<c:strike_lookup
    aura:id="myAccount"
    label="Account"
    object="Account"
    searchField="Name"
    placeholder="Select an Account"
    iconName="standard:account"
    subtitleField="Industry"
    order="Name"
    limit="5"
    loadingMessage="Loading..."
    errorMessage="Invalid input"
    showRecentRecords="true"
    value="{!v.myAccount}"/>
Controller
myActionHandler : function(component, event, helper) {
    //do something
}
davidchengIC commented 6 years ago

@mrichmon12 Thanks that works for me too!