Reputation: 49
i am creating a dynamic order form where you can add a new dropdown and text field into a row. I am using the XML view to create the elements but unlike jQuery, binding the same event to a class and using $('.element', parent) to access elements within a parent, you cant do this as easy with appcelerator as everything seems to use $. and an ID.
does anyone have any solutions for applying one function to multiple elements this way? i know i can bind the event easily but then the event would need to select elements within the selected object. the only way i have done this at the moment is to use a widget but that seems wrong and overkill to create a new instance for just a dropdown.
Many thanks
Upvotes: 1
Views: 99
Reputation: 3866
You cannot add listeners to multiple views in one call in Titanium.
Something people do a lot is adding the listener to the parent view and then use the e.source
property to determine what actual view triggered the event. This might not work for all use cases.
Upvotes: 1