PDA

View Full Version : Extend class Viewport to change Panel Title 'on the fly'



xava
29 Mar 2009, 2:41 PM
My contribution for the cause



Ext.ux.Viewport = function(config){
// call parent constructor
Ext.ux.Viewport.superclass.constructor.call(this, config);
};
Ext.extend(Ext.ux.Viewport, Ext.Viewport, {
changeTitle: function(e,t) {
Ext.getCmp(e).header.dom.textContent = t;
}
});
use:


_viewport = new Ext.ux.Viewport({
layout: 'border',
items: [new Ext.BoxComponent({ // raw
region: 'north',
el: 'north',
height: 50

[...]
}, {

id: 'center-panel',
region: 'center',
title: 'No Title',
layout: 'fit',
items: _showCentral

}]
});// App.viewport


_viewport.changeTitle('center-panel', 'New title');

mjlecomte
29 Mar 2009, 2:44 PM
http://extjs.com/deploy/dev/docs/?class=Ext.Panel&member=setTitle



Ext.getCmp('center-panel').setTitle('New title');

xava
29 Mar 2009, 2:50 PM
http://extjs.com/deploy/dev/docs/?class=Ext.Panel&member=setTitle



Ext.getCmp('center-panel').setTitle('New title');



(:| oh!

thanks! =D>