Sha256: 4ff6a52ccab046d0bac32f5aa40aaf93fb03dc740e50b3197d4ed62960a85700

Contents?: true

Size: 1.42 KB

Versions: 5

Compression:

Stored size: 1.42 KB

Contents

/**
 * A simple class that renders text directly into a toolbar.
 *
 *     @example
 *     Ext.create('Ext.panel.Panel', {
 *         title: 'Panel with TextItem',
 *         width: 300,
 *         height: 200,
 *         tbar: [
 *             { xtype: 'tbtext', text: 'Sample Text Item' }
 *         ],
 *         renderTo: Ext.getBody()
 *     });
 *
 * @constructor
 * Creates a new TextItem
 * @param {Object} text A text string, or a config object containing a #text property
 */
Ext.define('Ext.toolbar.TextItem', {
    extend: 'Ext.toolbar.Item',
    requires: ['Ext.XTemplate'],
    alias: 'widget.tbtext',
    alternateClassName: 'Ext.Toolbar.TextItem',

    /**
     * @cfg {String} text
     * The text to be used as innerHTML (html tags are accepted).
     */
    text: '',

    renderTpl: '{text}',
    //
    baseCls: Ext.baseCSSPrefix + 'toolbar-text',

    beforeRender : function() {
        var me = this;

        me.callParent();

        Ext.apply(me.renderData, {
            text: me.text
        });
    },

    /**
     * Updates this item's text, setting the text to be used as innerHTML.
     * @param {String} t The text to display (html accepted).
     */
    setText : function(t) {
        if (this.rendered) {
            this.el.update(t);
            this.ownerCt.doLayout(); // In case an empty text item (centered at zero height) receives new text.
        } else {
            this.text = t;
        }
    }
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
extjs-rails-4.1.0.alpha5 app/assets/javascripts/src/toolbar/TextItem.js
extjs-rails-4.1.0.alpha4 app/assets/javascripts/extjs-rails/src/toolbar/TextItem.js
extjs-rails-4.1.0.alpha3 app/assets/javascripts/extjs-rails/src/toolbar/TextItem.js
extjs-rails-4.1.0.alpha2 app/assets/javascripts/extjs-rails/src/toolbar/TextItem.js
extjs-rails-4.1.0.alpha1 app/assets/javascripts/extjs-rails/src/toolbar/TextItem.js