1

I'm trying to display the child object-OpenActivity of Opportunity

Is there another way to do this??

 <aura:iteration items="{!v.opps}" var="opp">
        <aura:iteration items="{!opp.OpenActivity}" var="task">
            <li>
                <ui:outputText value="{!task.Subject}" class="{!task.Id}"/>
            </li>
        </aura:iteration>
    </aura:iteration>
  • If you have an attribute that is just a single list with the OpenActivity of all your opps, you could do it with a single iteration. How is the value of the attribute "opps" set? – martin Aug 24 '15 at 7:59
  • Also, what is the class attribute being used for on your outputText? – martin Aug 24 '15 at 8:14
2

This way of iteration is the standard way to show parents and their childs information correctly. This doesn't avoid any best practice of iterating objects. Same approach we do in visualaforce using <apex:repeat> and it has no other difference except the tag <aura:iteration/>. As long as you have less than 1000 records this approach won't create any issues. More than this would slow down the page or cause lag.

If you have only single parent object then you would try to avoid parent level iteration. However, it doesn't create any significant difference as it needs 1 extra iteration only.

There is no other standard way to do this.

  • Turns out i needed <aura:iteration items="{!opp.OpenActivities}" var="task"> instead of <aura:iteration items="{!opp.OpenActivity}" var="task">. Thanks for this answer anyway!! – cloudforce Aug 25 '15 at 2:35

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.