PDA

View Full Version : change TabPanel property e.g titleAlign at runtime?



Mic1
6 Feb 2013, 10:47 AM
repost from stackoverflow (no answer - apologies for repetition):

I can change the title text of a tabpanel using refTabPanel.setTitle() - the built-in method. I can read the title align with 'var ta = refTabPanel.titleAlign, but how do I set title align? Is the only way .... to mention titleAlign in Config: [] and force extjs to build getter and setter methods? tia.
I really need somebody to explain this to me .. I have added
config: { titleAlign: 'right' },
to Ext.define('App1.view.TabBar1', {
and the constructed tabbar has the title aligned right. But with a perfectly good reference to the tabbar - tested with refTabBar.setTitle('NewTitle') .... refTabBar.setTitleAlign('left') does nothing. I read that the config should create getter/setter methods for titleAlign ... what am I missing? tia

Arg0n
6 Feb 2013, 1:37 PM
Did you try:


refTabBar.titleAlign = 'left';

if this doesn't work, you could do a view refresh after that:


refTabBar.getView().refresh();

I also don't get the config object thing. Allegedly also reset and apply methods will be generated.



getTitle: function() {
return this.title;
},

resetTitle: function() {
this.setTitle('Default Title');
},

setTitle: function(newTitle) {
this.title = this.applyTitle(newTitle) || newTitle;
},

applyTitle: function(newTitle) {
// custom code here
// e.g. Ext.get('titleEl').update(newTitle);
}


source: http://dev.sencha.com/deploy/ext-4.0.0/overview/index.html (seems old :x)