Search code examples
appceleratorappcelerator-titaniumstoppropagationevent-propagation

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


Solution

  • Yes, you can set touchEnabled : false on your ImageView