PDA

View Full Version : update title on the Tab at runtime



amanind
31 Oct 2011, 5:33 AM
Hi,

Can anyone help me.
Please let me know how to update title in tab at runtime.
Like I have initially title on the Tab is "abc" and now at runtime on click on some button I want to change it into "xyz" how to do this. Is there any method available. Right now i am working on Extjs version 3.1.

Thanks in advance
aMaN

plalx
31 Oct 2011, 10:46 AM
Hi,

If the tab itself is a panel it's very easy, you can use the panel.setTitle() method. If it's not a panel, there might be a better way, but I gave you an example on how you could do it.



Ext.onReady(function() {
var tabPanel = new Ext.TabPanel({
width: 200,
height: 200,
activeTab: 0,
items: {
//xtype: 'container',
title: 'Old Title',
listeners: {
'afterrender': function() {

//It it's a panel
this.setTitle('Updated Title');

//If it's not a panel (e.g. a container)
/*tabPanel.header.child(String.format(
'#{0}__{1} span.x-tab-strip-text',
tabPanel.id,
this.id
)).update('New Title');*/
}
}
}
});

tabPanel.render(document.body);
});

amanind
31 Oct 2011, 7:09 PM
Thanks scarsick for your helpful reply.
Yes i am using tabpanel and settitle method works.

Thanks alot once again