O'Reilly logo

Learning Ext JS - Fourth Edition by Armando Gonzalez, Crysfel Villa, Carlos A. Méndez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Templates

In the Ext JS library, we have two types of templates: Ext.Template and Ext.XTemplate. Let's see what the main differences between these two classes are:

  • Ext.Template represents an HTML fragment. This one, in my personal opinion, can be used in small things or simple representations.
  • Ext.XTemplate extends the Ext.Template class and provides advanced functionality.

Ext.Template

Let's look an example of Ext.Template:

Ext.onReady(function(){
  Ext.tip.QuickTipManager.init();
  var myTemplate = new Ext.Template([ //Step 1
    '<div class="container">','<div class="header">',
    '<img src="images/{logo}"width="88" height="53" alt=""/>',
    '<span>{titlecontents}</span><br>','</div>',
    '<div class="bookscontainer">','<span class="book">',
 '<img src="images/{book_a}" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required