O'Reilly logo

Ext JS 3.0 Cookbook by Jorge Ramon

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

Augmenting a class with a plugin

A way to change the behavior of a class is by using plugins. This recipe explains the mechanics of a plugin through an example plugin that provides visual feedback that indicates when a TextField or TextArea is a required field. The feedback will consist of a small glyph on the upper-left corner of the field's input elements, as seen in the following screenshot:

Augmenting a class with a plugin

How to do it...

  1. Define a couple of namespaces to encapsulate your plugin class:
    Ext.ns('Ext.ux', 'Ext.ux.plugins');
    
  2. Define the RequiredFieldGlyph plugin:
    Ext.ux.plugins.RequiredFieldGlyph = {
    init: function(field) {
    var thisXType = field.getXType();
    
  3. Inside the ...

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