Click to search on your search term.
Subscribe to Fig Leaf Tutorials


Need help with a project? Contact us at sales@figleaf.com.
From code reviews to project "jumpstarts" and full life-cycle development, we've got you covered!
Check out our case studies!
Follow us on Twitter!
Click here to join our Facebook group!

Ready to upgrade your skills? Try these instructor-led classes in Washington, DC:
Ext JS 6 Bootcamp
12/04/2017

Binding Custom JavaScript Methods to XTemplates

Page of 168

You can bind custom JavaScript methods to your template in order to implement functionality not directly supported by <tpl> constructs.
Custom methods are attached to the template as the final argument to the XTemplate constructor as illustrated by the following code snippet:

var tpl = Ext.create('Ext.XTemplate', 
  '
    ', '',
  • {[this.outputName(values)]}
  • '
    ', '
', { outputName: function(data) { // insert more complex logic here return data.lName + ',' + data.fName; } } ); var markup = tpl.apply([ {fName: 'Steve', lName: 'Drucker', type: 'Developer'}, {fName: 'Jason', lName: 'Perry', type: 'Instructor'}, {fName: 'Tracey',lName: 'Dunn', type: 'Creative'}, ] );
Page of 168
comments powered by Disqus