Quantcast
Viewing all articles
Browse latest Browse all 8068

Add/remove/change markup conditionally based on model properties

Is there a way when binding a collection to a TableView to conditionally change the markup to show differences between models? For example, to be able to indicate colour-coded categories, you would theoretically loop through the models in the collection, find the element associated with the given id and perhaps change the class or add a property. In other cases you might want to add a Label or some other element.

Obviously I can't just say:

var id = model.get('id');
$.id.color = '#fff';
So how could I evaluate the corresponding element given a referenced variable?

I want to avoid if at all possible rendering all the elements programatically.

Ti 3.2.1, iOS 7.0.3.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>