ExtJs Template: Using Template Member Functions

Posted By Vitalii | March 11, 2013 | ExtJS 4.1.1
0 2947
‚ÄčOne or more member functions can be specified in a configuration object passed into the XTemplate constructor for more complex processing.

Js Code

tpl: ['<tpl for=".">',
        '<ul class="details">',
            '<li><b>Name:</b> {Name}</li>',
            '<li><b>Email:</b> {Email}</li>',
            '<tpl if="this.isDisabled(values)">',
                '<li class="warning"><b>Warning:</b> user is disabled</li>',
            '<tpl else>',
                '<li class="comment"><b>Comment:</b> active user</li>',
            '</tpl>',
        '</ul>',
      '</tpl>',
      {
          isDisabled: function (r) {
              return r.Disabled === true;
          }
      }],

            

ExtJs 4.1 TreeGrid Treecolumn Custom Icon

Posted By Vitalii | September 05, 2012 | ExtJS 4.1.0
0 4303
To set treecolumn icon you can use "iconCls" property.

Js Code

Ext.define('MenuItem', {
    extend: 'Ext.data.Model',
    idProperty: 'Id',
    fields: [
        { name: 'Id', type: 'string' },
        { name: 'Name', type: 'string' },
        { name: 'Disabled', type: 'bool' },
        {
            name: 'iconCls',
            type: 'string',
            convert: function (v, r) {
                return r.get('Disabled') ? 'icon-disabled' : 'icon-enabled'
            }
        }
    ]
});