PDA

View Full Version : Collapse button missing on panel after using setTitle()



gwinning
8 Mar 2012, 5:17 AM
Hi,

Any suggestions on how to get the collapse button back after using setTitle() ?

If I remove the setTitle(); method, the default title is on the panel and the collapse button is there. After calling setTitle(), the title is set, but the button is missing....

initComponent: function() {
var me = this;
me.callParent(arguments);
var params = Ext.urlDecode(location.search.substr(1));
custNo = params.custNo;
var leftPanel = Ext.getCmp('pnlLeft');
leftPanel.setTitle("Cust#: " + custNo);

mitchellsimoens
8 Mar 2012, 3:42 PM
You should set the title property before the callParent


initComponent: function() {
var me = this;

var params = Ext.urlDecode(location.search.substr(1));
custNo = params.custNo;
var leftPanel = Ext.getCmp('pnlLeft');
me.title = 'Cust#: ' + custNo;

me.callParent();
}

gwinning
9 Mar 2012, 4:36 AM
Thanks, but "me.Title" is not seeting that particular panels title, and any reference to "leftPanel" before callParent causes a javascript error:
leftPanel is undefined

Ext.getCmp('pnlLef') appears to be undefined if put before callParent.

gwinning
9 Mar 2012, 4:46 AM
This fixed it, but I can't explain why. I moved the call to "Ext.urlDecode" to before getParent (moved it by accident) and the button no longer dissapears. Go figure.
initComponent: function() {
var me = this;
var params = Ext.urlDecode(location.search.substr(1));
custNo = params.custNo;
me.callParent();
var leftPanel = Ext.getCmp('pnlLeft');
leftPanel.title = 'Cust#: ' + custNo;