PDA

View Full Version : Panel.setTitle after construct but before render



inf3rno
3 Jan 2011, 1:22 PM
Hi!

Can anybody tell me, why this works:


var c=new Ext.Panel(
{
title: "a"
});
c.title="test"; //c.rendered is false here

new Ext.Panel(
{
renderTo: Ext.getBody(),
items:
[
c
]
});

and this not:


var c=new Ext.Panel();
c.title="test"; //c.rendered is false here

new Ext.Panel(
{
renderTo: Ext.getBody(),
items:
[
c
]
});

and how to fix it? :D

skirtle
3 Jan 2011, 1:56 PM
This is explained in the docs for Ext.Panel's setTitle() method.

In short, you need header: true if you don't initially specify a title.

inf3rno
3 Jan 2011, 3:59 PM
Thanks! :-)