function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sujit Das@AccentureSujit 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.
 
<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.
Rowan  ChristmasRowan Christmas
<table class="slds-table slds-table--bordered">
   <tbody>
    <aura:iteration items="{!v.rows}" var="row">
       <tr>
        <aura:iteration items="{!row.dataCells}" var="cell">
            <td> <a href="{!cell.value}">{!cell.label}</a></td>
        </aura:iteration>
      </tr>
   </aura:iteration>
</tbody>
</table>

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...
Lochana RajputLochana Rajput

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!!!!

Naveen KNNaveen KN
this might be useful 
https://www.codengine.in/2019/07/nested-iteration-salesforce-lightning-aura-components.html