concept XTemplates in category ext js

appears as: XTemplates
Ext JS in Action, Second Edition

This is an excerpt from Manning's book Ext JS in Action, Second Edition.

By using the template, you were able to get two differently styled HTML structures in the DOM. What if you had an array of objects? For instance, what if an Ajax request returned an array of data objects, and you needed to apply a template for each data object? One way to handle this is to loop through the array, which is easily done with a generic for loop or the more robust Ext.each utility method. I say nay to that approach. I’d use XTemplates instead, which makes the code much cleaner.

Remember, the advantage of using XTemplates in this case is that you don’t have to write code to loop through the array of objects. You let the framework do the dirty work for you. The capabilities of XTemplates extend far beyond merely looping through arrays, which increases its usability exponentially.