ste cooper
ste cooper

Reputation: 49

Appcelerator stop children firing parents event

I have a parent View with an click event and an attribute. within this i have 5 other elements. The issue is if i click on one of those elements it picks up the parents event listener and the code which is called checks to see if the clicked element has a specific data attribute.

is there any way to only apply the click event to the parent and not the children?

currently i am checking if the e.source has the attribute and if not checking the parent but it feels wrong.

Example code:

<View onClick='foo' target='someId'>
    <imageView/>
    <imageView/>
    <imageView/>
</View>

Thanks

Upvotes: 1

Views: 564

Answers (2)

Shawn
Shawn

Reputation: 2745

Setting bubbleParent: false will work for you, and you can keep touchEnabled: true just in case you still need touch events on ImageView.

Upvotes: 2

Thomas Lemaitre
Thomas Lemaitre

Reputation: 1154

Yes, you can set touchEnabled : false on your ImageView

Upvotes: 4

Related Questions