1

I am using this lines in my lightning component:

<fieldset id="someID" onchange="{!c.someJSFunction}">
<c:inputlookup type="{!sometype}" value="{!somevalue}" className="slds-input"/> 
<lightning:input aura:id="anotherId" name="anotherAccId" value="{!somevalue}" />
</fieldset>

as you can see I am using another component inside the fieldset. What I wanted to do is that every time the inputlookup changes, it will also perform the someJSFunction.

this is the sample content of the someJSFunction:

var someAccId = component.find("anotherId").get("v.value");
console.log('someAccId '+someAccId );

but it didn't work. How can I get the method to be called every time there is a change from the component inputlookup?

1 Answer 1

0

On the c:inputlookup, you can register a component event called myChangeEvent, which you fire anytime there's a change happening in your c:inputlookup component.

Then you can detect changes within the parent component inline with your other inputLookup attributes like this:

<c:inputlookup type="{!sometype}" value="{!somevalue}" className="slds-input" myChangeEvent="{! c.handleInputLookupChanges }"/>

Then the parent's JS controller can handle the changes in the handleInputLookupChanges controller method however you please. Look into event.getParams() to see how to handle incoming changes.

You must log in to answer this question.

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