Refer the parent of the element in NS core


#1

Hi,
I want a reference to the parent of the clicked element.
Example:

<StackLayout id="1"> <Label tap="tapped" /> </StackLayout>

When I click on Label I want a reference to StackLayout(it’s parent).How can I do that in NS-core ?


#2

Add an id property to the Label and grab the view by id in the associated class. Then you should be able to read the parent property of the element.

xml:

<Label id="myLabel">

.js / .ts:

page.getViewById("myLabel").parent // this is the StackLayout