This document provides an overview of advanced templates for Ext JS, including member functions, subtemplates, recursive templates, and list layout. Member functions allow defining arbitrary JavaScript functions within a template. Subtemplates allow one template to call another, useful for reducing redundancy. Recursive templates allow a template to call itself to handle hierarchical data. List layout discusses using the xindex variable and modulo operator to group list items for advanced layouts. An example app and additional resources are provided.
7. Member Functions
• Arbitrary JavaScript functions can be defined and
executed as part of the template
• Extremely useful for adding advanced functionality
and all of the techniques shown today will use them
• Defined by passing a config object as last parameter
and attaching functions as properties
• Three basic ways of accessing member functions
from template
10. Subtemplates
• Templates can call other templates
• Great if there is a lot of redundancy in your templates
• Makes use of the “apply” method
• Can optionally create a “manager” class to name and
easily access subtemplates
14. Recursive Templates
• Uses the same methodology as subtemplates: templates
can call other templates, even themselves
• Great for hierarchical/nested data
17. List Layout
• Templates are often used to create lists (ex.
DataView)
• Typically laid out using normal flow (inline or block)
or stacked next to each other using float
• It’s possible using the “xindex” variable and the
modulo operator to create wrapper elements around
groups of items for more advanced layout strategies