PDA

View Full Version : [CLOSED]panel.setTitle("hi"); not working



oe.elvik
4 Mar 2011, 4:30 AM
using:
panel.setTitle("hi");

not working when panel is inside a TabPanel

steffenk
4 Mar 2011, 9:18 AM
If you look to the docs, tabpanels are different to Ext3.
For example, go to
http://dev.sencha.com/deploy/ext-4.0-pr3/examples/window/layout.html

Open the window and then eg execute this in console:


Ext.getCmp("tabpanel-1018").getActiveTab().tab.setText('hi')

Indeed result looks strange as the tab is shortened, and creating the tabpanel use title for tab text.
Let's see what the team suggest here.

oe.elvik
5 Mar 2011, 1:05 AM
I'm creating a Ext.panel.Panel an adds it to a TabPanel.
Later i want to change the tab text of this panel.
Im also curios if i can do this using the reference i have to my Ext.panel.Panel, or if i have to find a new reference to it via the TabPanel.get or something like that..

oe.elvik
9 Mar 2011, 2:02 AM
I'm still wondering if anybodey out there might know how i can set a new title of a tab when i only have the reference of the panel witch is inside a TabPanel. It is not nesseserry the active tab so the above wont help me. Still think it makes more sense if panel.setTitle is an alias for setting the tab title, so I hope this issue will be adressed.

evant
9 Mar 2011, 3:47 AM
Not a bug:



Ext.require('*');
Ext.onReady(function(){
var tabs = new Ext.tab.TabPanel({
renderTo: document.body,
width: 200,
height: 200,
items: {
title: 'Foo',
html: 'a'
}
});

setTimeout(function(){
tabs.items.first().tab.setText('Bar');
}, 1000);
});

oe.elvik
9 Mar 2011, 5:27 AM
Ok, let me clerify once more.

Is there a way to get ther reference to the tab when i only have a reference to the panel witch i have added to my TabPanel.

panel.tab is undifined even after i have added it to a TabPanel.

You suggest going through TabPanel.first().tab, but I dont know the position of my panel in the TabPanel. so i cant use first.

Is there a way of getting the regerence to the tab when you have a reference to the component added to TabPanel?

In ExtJs 3 these were the same objecet so that was no stress, but in extjs 4 i cant find any bining between tab and component.

oe.elvik
9 Mar 2011, 5:32 AM
Never mind..

I figured out I just forgot to use setText insted of setTitle.
hehe

Tanks allot! now it works

steffenk
9 Mar 2011, 6:40 AM
@Evan, did you checked what happens what i do in #2? Text si replaced, but tabs are not redrawn!

Animal
9 Mar 2011, 7:03 AM
Ok, let me clerify once more.

Is there a way to get ther reference to the tab when i only have a reference to the panel witch i have added to my TabPanel.



Ext.getCmp("panel-1022").tab.el.dom