0

I have created a custom lookup based on below link:

http://www.sfdcmonkey.com/2017/07/17/re-usable-custom-lookup/

Here is my component code:

<aura:component>
<aura:attribute name="conList" type="contact[]" description="Will retrieve contacts from controller" />
<aura:iteration items="{!v.conList}" var="con">
<tr>
<td>{!con.Name}</td>
<td><c:customLookup objectAPIName="Account" selectedRecordId="{!con.AccountId}"/></td>
<td>{!con.Account.Email}</td>
<aura:iteration>
</aura:component>

My scenarios: 1) here i need to get the value of account email from account dynamically based on selection of custom look up

Obsevations: 1) On change Dynamic binding is not happening to '{!con.Account.Email}' field unlike other fields.

I'm unable to lock onchange effect of <c:customLookup />. Tried with <aura:handler name="change" value="{!v.conList}" action="{!c.action}"/> But,this action will fires only if i add or remove a contact from the list. Any idea on how to achieve this?

1

There are couple reports that changes are not detected in aura:iteration. A couple weeks ago I reported this behaviour back to the lightning repo: https://github.com/forcedotcom/aura/issues/128

I would suggest to extend your c:customLookup and let it throw a custom change event when it is changed and later handle this in your outer component.

<!-- customLookup -->
<aura:registerEvent name="dataChange" type="c:custom_event" />
...
<ui:inputText change="{!c.lkpChanged}" ....

Your lookup controller:

lkpChanged: function(cmp, evt, helper) {
    cmp.getEvent("dataChange").fire();
},

And in your outer component you catch and handle it:

<aura:handler name="dataChange" event="c:custom_event" action="{!c.dataChanged}" />
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.