PDA

View Full Version : Buttons on left and right of Toolbar



shizny
4 Jun 2011, 11:17 AM
Hi, I'm having a tough time figuring out how to get left and right aligned buttons on a toolbar. I've tried the '->' deal but no dice. Here is my code... any help?



// JavaScript Document
Ext.namespace('newwidgets');

newwidgets.HeaderMenu = Ext.extend(Ext.Toolbar, {
title: 'Available Projects',
backclickaction: 'goHome',
buttonclickscope: this,
showbackbutton: true,
showdonebutton: false,
doneclickaction: 'goHome',
initComponent: function() {
if (this.showbackbutton) {
Ext.apply(this, {
items: this.buildItems()
});
}
newwidgets.HeaderMenu.superclass.initComponent.call(this);
},
buildItems: function() {
var backClickButton = new newwidgets.BackClickButton({controlleraction: this.backclickaction, scope: this.buttonclickscope});
if (this.showdonebutton) {
var doneButton = new newwidgets.DoneButton({controlleraction: this.doneclickaction, scope: this.buttonclickscope});
return [backClickButton, doneButton];
}
else {
return [backClickButton];
}
}
});

tolbahady
4 Jun 2011, 11:55 AM
Change the return statment to


return [backClickButton,{xtype:'spacer'}, doneButton];


{xtype:'spacer'} will extend and make the two buttons stick to the sides

shizny
4 Jun 2011, 1:07 PM
ah, thank you :)

mitchellsimoens
4 Jun 2011, 3:46 PM
Yes, only ToolBar can translate '->', ' ' and '-' to the appropriate xtypes.