PDA

View Full Version : How do i set the title of a panel



profunctional
30 Jun 2010, 9:18 AM
I tried to set the "title" attribute for both the Ext.Panel item, and also the Ext.NestedList item using the code below:

var dashboard = new Ext.Panel({
title: 'Dashboard',
layout: 'card',
fullscreen: true,
items:
[
{
xtype: 'nestedlist',
title: 'Dashboard',
items:
[
{
text: '<span>Dashboard</span><small class="counter">3</small>'
}
]
}
]

});

The title on the toolbar is still blank. What am I doing wrong?

TommyMaintz
30 Jun 2010, 9:31 AM
A panel doesnt support the title property like it does in Ext JS (yet). The easiest way to get around this is to do the following:



{
// your panel config here
dockedItems: [{
dock: 'top',
title: 'your title',
xtype: 'toolbar'
}]
}

profunctional
30 Jun 2010, 12:31 PM
Thanks for the quick response. I tried that and got a title. Now how do I get rid of the second toolbar on the bottom? I've attached a screenshot.

Thanks again.

TommyMaintz
30 Jun 2010, 12:45 PM
Ooh, it looks like you are trying to add a title to a nestedlist. Nestedlist already adds a toolbar in order to have place to put the back button. You can pass configuration and additional items to this toolbar like this:



xtype: 'nestedlist',
// your other nestedlist configuration
toolbar: {
title: 'Dashboard'
// you can also add items to add more buttons here
// for example:
// items: [{xtype: 'spacer'}, {iconCls: 'refresh', handler: yourFn}]
}