PDA

View Full Version : Access Toolbar & StatusBar From Controller



azinyama
24 Sep 2012, 3:26 AM
Good day all!!!

I have added to my Viewport a toolbar with menu items at the top and a status bar at the bottom. Code below:



initComponent: function()
{
Ext.apply(this,
{
id : 'desktopWindow',
closable : false,
resizable : false,
draggable : false,
border : false,
bodyBorder : false,
frame : false,
region : 'center',
layout : 'card',
dockedItems : [{
xtype : 'toolbar',
dock : 'top',
id : 'desktopToolBar',
layout : 'table',
border : '0',
bodyBorder : false
},
{
xtype : 'statusbar',
dock : 'bottom',
id : 'desktopStatusBar',
autoClear : 1000,
defaultText : 'Ready...',
iconCls : 'x-status-valid',
width : '100%',
items : ['-',
{
xtype : 'tbtext',
id : 'desktopUser',
text : this.Users_Name,
flex : 1
},
'-',
{
xtype : 'tbtext',
id : 'desktopClock',
text : Ext.Date.format(new Date(), 'l, F d, H:i:s'),
flex : 1
}]
}]
});

this.callParent(arguments);

this.startClockTask();

this.on('beforedestroy', this.stopClockTask, this);
},


Now I'm getting stuck at access the toolbar and status bar from the contoller. How would I go about doing this. I have tried this (below):



{
ref : 'desktopToolBar',
selector: 'desktopWindow [dockedItems=desktopToolBar]'
},


But no luck there.

Help is greatly appreciated.

redraid
24 Sep 2012, 5:17 AM
try:

{ ref : 'desktopToolBar', selector: 'desktopWindow desktopToolBar' },

sword-it
24 Sep 2012, 5:23 AM
you can also try this code-




{
ref : 'desktopToolBar'
, selector: '#desktopWindow dockedItem[id=desktopToolBar]'
}