O'Reilly logo

Ext JS 4 Web Application Development Cookbook by Stuart Ashworth, Andrew Duncan

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

Executing inline JavaScript to in an XTemplate customize appearance

Within an Ext.XTemplate's HTML we are able to include small pieces of JavaScript that will be executed when the template is processed. This feature is extremely useful for adding things such as, conditional formatting, simple member manipulation, or formatting.

In this recipe, we are going to demonstrate how to include some inline JavaScript within an Ext.XTemplate, in order to format our output dynamically based on the data's values.

The example that we will use is a simple bug list. We will use inline JavaScript code to color each row based on the severity of the bug.

How to do it...

  1. We start by defining an array of bugs that we will use in our template (we have only shown one to ...

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