In the documentation, it seems that you can prevent bubbling by passing an arguments to an click event on a text field:
http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.TextField-event-click
Using their new Alloy framework, I have a textfield declared like so:
<TextField id='name' onClick='doStuff' />
and in my controller I have this function:
function doStuff(e) {
alert('hello');
}
However, this element is wrapped in a container element which also has an onClick event, and I would like to prevent that one from firing when I click on the text field. how can I accomplish this?
Try:
function doStuff(e){
e.cancelBubble = true;
alert('hello');
}
Suppose you have written this code in xml file:
<View id = “parent” onClick = “parentClicked”>
<ImageView id=“sampleImage” onClick= “childImageClicked”>
</ImageView>
</View>
Then
Try this in TSS :
“#sampleImage” : {
bubbleParent : false,
}
or if you want to do it in Javascript :
function function_name(e){
e.cancelBubble = true;
}
http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Event-property-cancelBubble
I hope this will work for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With