0

I have a Component where I show list of Accounts using "lightning:verticalNavigation". Now upon clicking one Account from this list, I would like to Open all its associated Contacts in same section. How can I do that? I don't want to use Accordion for some reason.

Component

<aura:handler name="init" value="{!this}" action="{!c.doInit1}" />

 <aura:attribute name="items" type="Object"/>

 <aura:attribute name="items2" type="String" />

 <div class="slds-m-around_xx-small">  

  <lightning:layout>
        <lightning:layoutItem>
            <lightning:verticalNavigation selectedItem="{!v.selectedaccId}"
                                          onselect="{!c.onSelect}">
                <lightning:verticalNavigationSection label="Select Account">
                    <aura:iteration items="{!v.items}" var="clnt" indexVar="index">
                        <lightning:verticalNavigationItemIcon label="{!clnt.Name}" 
                                                          name="{!clnt.Id}"
                                                          iconName="utility:open_folder"/>
                    </aura:iteration>
                </lightning:verticalNavigationSection>
            </lightning:verticalNavigation>
        </lightning:layoutItem>          
    </lightning:layout>
doInit1: function (cmp, event, helper) {
    var action = cmp.get("c.getTreeData1");
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (state === "SUCCESS") {
            cmp.set('v.items', response.getReturnValue());
        }
        
    });
    $A.enqueueAction(action);
},

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.