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
Maria Alexandra AndricaMaria Alexandra Andrica 

data row index in iteration

I'm trying to find out the row number for which the toggle was clicked but everything I did it is not working. 
<aura:iteration items="{!v.newWFs}" var="header" indexVar="rowIndex"> 
                                <tr aria-selected="false" class="slds-hint-parent"  id="{!rowIndex}">
                                    <td aura:id="submit" label="{!rowIndex}" data-value="{!rowIndex}" data-row-index="{!rowIndex}" onclick="{!c.toggle}">
                                        <span class="slds-assistive-text">Details    </span>
                                    </button> -->
                                        <div data-drag-id="{!rowIndex}">
                                            <aura:if isTrue="{!v.NewWFFilters}">
                                                <h1>
                                                    <lightning:icon id="{!rowIndex}" data-selected-Index="{!rowIndex}" iconName="utility:chevrondown" alternativeText="Workflows" size="x-small"/>
                                                </h1>
                                            </aura:if>
                                            <aura:if isTrue="{!not(v.NewWFFilters)}">
                                                <h1>
                                                    <lightning:icon id="{!rowIndex}" data-selected-Index="{!rowIndex}" iconName="utility:chevronright" alternativeText="Workflows" size="x-small"/>
                                                </h1>
                                            </aura:if>
                                        </div>
                                    </td>


    toggle : function(component, event, helper) {
        var rows = component.get("v.newWFs");
        rows[event.target.dataset.index].expanded = !rows[event.target.dataset.index].expanded;
        component.set("v.newWFs", rows);
        component.set("v.NewWFFilters", !component.get("v.NewWFFilters")); 
    },

 
itzmukeshy7itzmukeshy7
Why you don't wana use the lightning:accordion (https://developer.salesforce.com/docs/component-library/bundle/lightning:accordion/example) standard component?
Maria Alexandra AndricaMaria Alexandra Andrica
How can I use it with table? 
itzmukeshy7itzmukeshy7
I can help you if you share some UI, what you are trying to develop.