I have a list of custom class objects. I am using aura:iteration to iterate the list. Now I want to show one of the variable of the class object which in itself is object.
For example in Salesforce Classic
<apex:repeat value="{!RequiredStoreActivities}" var="activity">
<apex:variable value="{!activity.StoreActivityCategory}" var="activityCategory" />
<div >
<span ></span>
<apex:outputText value="{!activityCategory.Store_Activity_Category__c}" />
</div>
<div >
<ul >
<apex:repeat value="{!activity.StoreActivities}" var="storeActivity">
<li>
<apex:outputText value="{!storeActivity.Name}" />
</li>
</apex:repeat>
</ul>
</div>
</apex:repeat>
Where RequiredStoreActivities is a class
public class RequiredStoreActivity{
public final Store_Visit_Activity_Category__c StoreActivityCategory {get; private set;}
public List<Store_Activity__c> StoreActivities {get; set;}
}
I have to implement the same in lightning. Can somebody help me in it
till now I am able to code the below code
<aura:iteration items="{!v.RequiredStoreActivity}" var="st">
<aura:renderIf isTrue="{!v.showActivity1}">
<c:StoreActCategory storeActivityCategory="{!st.StoreActivityCategory}"/>
</aura:renderIf>
</aura:iteration>
Since we cannot use apex:iteration
inside apex:iteration
. I have passed the value to a component. But on the another component the value is getting undefined
Best Answer
Just tried aura:iteration inside the aura:iteration and works great .Here is a sample that clearly shows no harm in using nested aura:iterations
What you might be missing from my opinion is below
The equivalent of apex:var in lightning is aura:attribute .You can declare aura:attribute to store and retrieve values from same as you do for apex:variable in Visualforce