O'Reilly logo

Learning Ext JS 4 by Armando Gonzalez, Crysfel Villa

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

A more complex dataview

A dataview component is a great component in the Ext JS library. In the next example, we are going to list the users in the application and we are going to activate or deactivate them with a double-click on the user record.

Let's add to our previous dataview code some lines:

/**
 * @classApp.view.UsersView
 * @extendsExt.view.View
 * This the definition of our users data view
 *
 */
Ext.define('App.view.UsersView', {
  extend: 'Ext.view.View',
  xtype:'usersview',
  store:'Users',
  emptyText:'No users available',
  itemSelector: 'div.user',
  tpl:[
    '<tpl for =".">',
      '<tpl if="active &gt; 0">',// interrogate if the user is active (step one) '<div class="user active">', '<tpl else>', '<div class="user inactive">', '</tpl>', '<div class="content">', ...

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