You need to sign in to do that
Don't have an account?
Sujit Das@Accenture
Lightning : Aura iteration, iterate over a list
Hi,
As per aura documentations, we can iterate over a List in aura iteration.
I am trying to create a nested aura iteration. The outer iteration will be on List< Account> accList and the inner iteration will iterate on List which will be obtained from the map Map< Id, List< Contact>> accContactMap.
I am trying to use the List in aura iteration like.
However, I am getting the following error. "Failed to save undefined: expecting a positive integer, found 'section' at column 14 of expression: v.formQueMap[section.Id]: Source". I tried using items="{!v.accContactMap.get('account.Id')}" with no luck.
As per aura documentations, we can iterate over a List in aura iteration.
I am trying to create a nested aura iteration. The outer iteration will be on List< Account> accList and the inner iteration will iterate on List which will be obtained from the map Map< Id, List< Contact>> accContactMap.
I am trying to use the List in aura iteration like.
<aura:iteration items="{!v.accList}" var="account" indexVar="indexAcc"> <table class="slds-table slds-table--bordered slds-table--striped" style="margin-top:30px;"> <tbody> <tr> <td>{!account.Name}</td> </tr> <tr> <!-- Use the account.Id to get the value of the map --> <aura:iteration items="{!v.accContactMap[account.Id]}" var="contact" indexVar="indexAcc"> <table class="slds-table slds-table--bordered slds-table--striped" style="margin-top:30px;"> <tbody> <tr> <td><div onclick="{!c.editContact}" data-index="{!indexCon}" style="color:#0070d2;cursor: pointer;">Edit</div></td> <td>{!contact.Name}</td> </tr> </tbody> </table> </aura:iteration> </tr> </tbody> </table> </aura:iteration>
However, I am getting the following error. "Failed to save undefined: expecting a positive integer, found 'section' at column 14 of expression: v.formQueMap[section.Id]: Source". I tried using items="{!v.accContactMap.get('account.Id')}" with no luck.
This is how I did almost the same thing... there is nothing that looks wrong with your code that I see right away. I would ensure that all the variables have data by putting a `debugger;` statement when you set things up. Make sure you can address the data you want in the browser console, you may be parsing the arrays/maps wrong somewhere...
Rowan Christmas
Can you please post your code here...
I need to display table containg Parent records with child records. For this I used wrapper, but it is having issue with ui:inputDate, so I decided to use map, but not getting how to do it...
Thanks in advance!!!!
https://www.codengine.in/2019/07/nested-iteration-salesforce-lightning-aura-components.html