PDA

View Full Version : Update text of Ext.menu.TextItem



tkachev.alex
6 Feb 2008, 10:00 AM
I've recently needed to update a text of a Ext.menu.TextItem component that was added to the bottom toolbar (bbar) of the Ext.Panel.
:( - Unfortunately the Ext.menu.TextItem implementation doesn't provide such trivial functionality.
:> - Fortunately, this functionality is very easy to add

Here is my implementation of Ext.ux.menu.TextItem that has setText method:


Ext.namespace("Ext.ux.menu.TextItem");

Ext.ux.menu.TextItem = function(text){
Ext.ux.menu.TextItem.superclass.constructor.call(this, text);
};

Ext.extend(Ext.ux.menu.TextItem, Ext.menu.TextItem, {

setText : function(text){
var element = Ext.get(this.el);
element.update(text);
}

});

To ExtJS team:
I think this functionality should be included in ExtJS core (ie add setText method to Ext.menu.TextItem), since I don't see any reason to prevent update of a text in a Ext.menu.TextItem, after it has been created.