PDA

View Full Version : Panel Header in Ext 4.1.x



bcarollo
4 Jan 2013, 8:20 AM
Hi All,

I'm struggling again with something I think is very simple:
How do I add a button and/or a menu to the header of a panel?

Thanks in advance

Ben

friend
4 Jan 2013, 10:03 AM
In a panel's afterrender event, you can do something like this:



somePanel.getHeader().add({
xtype: 'combobox',
<...>
});

bcarollo
5 Jan 2013, 2:24 AM
Hi friend,

thanks a lot for your answer, however I would like to avoid the use of the afterrender.

I was wondering if is possible to something like :


Ext.define("ReadingWorkspaceUXPrototype.view.myPanels.PanelA", {
extend: 'Ext.panel.Panel',
alias: 'widget.panelA',
layout: 'fit',
//frame: true,
closable: true,
//collapsible: true,
//animCollapse: true,
draggable: {
moveOnDrag: false
},
tools: [
{
type:'linktool',
tooltip: 'Your tooltip',
handler: function(event, toolEl, panel){
// Your handler function
}
}
],
header: [
{

xtype: 'button',
text: 'My Button ...'


}

]

});

Is it possible to add objects in the panel header in the way I've described above?
If not how can I add objects using the beforerender event ? (I'm using extjs 4.1.1)

Many thanks in advance

Ben