nativescript-accordion icon indicating copy to clipboard operation
nativescript-accordion copied to clipboard

how to get parent index when click the child

Open RajkumarRepo opened this issue 6 years ago • 4 comments
trafficstars

I'm not able to get parent and child index individually I'm able to get id but when click the child I want to get the parent id.

RajkumarRepo avatar Jan 22 '19 08:01 RajkumarRepo

I want to get parent index when click the child.

RajkumarRepo avatar Jan 22 '19 12:01 RajkumarRepo

There is a tap event emitted when tapping on a child it contains the parent index event.index and the child index event.childIndex

triniwiz avatar Jan 22 '19 13:01 triniwiz

Thank you yeah it was worked perfectly.

Design File

<Accordion class="list-group" [items]="groups"
            (itemContentTap)="onItemContentTap($event)">

Ts File

onItemContentTap(event) {
        const data = event.data;
        console.log(event.index);
        console.log(event.childIndex); // Index is always one more than what user taps
        console.log(data); 
}

RajkumarRepo avatar Jan 24 '19 12:01 RajkumarRepo

Child Index returns wrong Value

RajkumarRepo avatar Mar 06 '19 11:03 RajkumarRepo