Conditional view rendering using XTemplate

In the previous recipe, we saw how to use XTemplate, but did not utilize its capabilities such as using auto-filling arrays, conditional processing, math function, and so on to build the view by making different decisions on the incoming data. For example, in the previous recipe, we are showing all kinds of flowers in our view. What if we just want to show roses? This is where XTemplate helps us to put the constructs inside the template definition and not make any change to the data.

Getting ready

Make sure that you have set up your development environment by following the recipes outlined in Chapter 1.

How to do it...

Carry out the following steps:

  1. Create and open a new file named ch04_03.js and paste the ...

Get Sencha Touch Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.