You need to sign in to do that
Don't have an account?

How to call get value in aura:iteration
Below code doesn't get the value from the aura:iteration
<aura:iteration items="{!v.contactList}" var="item">
<ul class="slds-has-dividers_bottom-space">
<li class="slds-item">
<lightning:tile label="{!item.Contact__r.Name}">
</lightning:tile>
</li>
</ul>
</aura:iteration>
In Js Helper:- c.set("v.contactList",storedResponse);
callDetails=[SELECT Name, Contact__r.Name FROM PersonDetails__c ORDER BY CreatedDate desc LIMIT 20 ];
I want get the contact assoicated information but doesn't get it.
<aura:iteration items="{!v.contactList}" var="item">
<ul class="slds-has-dividers_bottom-space">
<li class="slds-item">
<lightning:tile label="{!item.Contact__r.Name}">
</lightning:tile>
</li>
</ul>
</aura:iteration>
In Js Helper:- c.set("v.contactList",storedResponse);
callDetails=[SELECT Name, Contact__r.Name FROM PersonDetails__c ORDER BY CreatedDate desc LIMIT 20 ];
I want get the contact assoicated information but doesn't get it.
I think you have to write this js storedResponse in this way:-
In JS Helper:
storedResponse.forEach(e => {
e['ContactName']=e.Contact__r.Name;
});
then set value in contactList attribute
c.set("v.contactList",storedResponse);
In Component:
<aura:iteration items="{!v.contactList}" var="item">
<ul class="slds-has-dividers_bottom-space">
<li class="slds-item">
<lightning:tile label="{!item.ContactName}"> // Changes in that field
</lightning:tile>
</li>
</ul>
</aura:iteration>
Hope this explanation will resolve your query. Mark it as the best answer if you find it helpful.
Thanks
Akshay
All Answers
I think you have to write this js storedResponse in this way:-
In JS Helper:
storedResponse.forEach(e => {
e['ContactName']=e.Contact__r.Name;
});
then set value in contactList attribute
c.set("v.contactList",storedResponse);
In Component:
<aura:iteration items="{!v.contactList}" var="item">
<ul class="slds-has-dividers_bottom-space">
<li class="slds-item">
<lightning:tile label="{!item.ContactName}"> // Changes in that field
</lightning:tile>
</li>
</ul>
</aura:iteration>
Hope this explanation will resolve your query. Mark it as the best answer if you find it helpful.
Thanks
Akshay