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

Implementing Conditional Processing

Page of 168

Use <tpl if> to implement branching as illustrated below:

var tpl = Ext.create('Ext.XTemplate', 
  '
    ', '', '', '
  • {fName} {lName}
  • ', '', '
  • Item Redacted
  • ', '
    ', '
    ', '
' ); var markup = tpl.apply({ authors: [ {fName: 'Steve', lName: 'Drucker', redact: true}, {fName: 'Jason', lName: 'Perry', redact: false} ], company: 'Fig Leaf Software', url: 'http://www.figleaf.com' );


For handling three or more specific values you can opt to use <tpl switch>:

var tpl = Ext.create('Ext.XTemplate', 
  '
    ', '', '', '' '
  • {fName} {lName}
  • ', '', '
  • {fName} {lName}
  • ', '', '
  • {fName} {lName}
  • ', '
    ', '
    ', '
    ', '
' ); var markup = tpl.apply({ authors: [ {fName: 'Steve', lName: 'Drucker', type: 'Developer'}, {fName: 'Jason', lName: 'Perry', type: 'Instructor'}, {fName: 'Tracey', lName: 'Dunn', type: 'Creative'} ], company: 'Fig Leaf Software', url: 'http://www.figleaf.com' );
Page of 168
comments powered by Disqus