PDA

View Full Version : Adding button to panel?



TheBigOnion
7 May 2010, 9:57 AM
Hello all,
I am trying to add a button on the bottom of my panel. Here is what I have:



Ext.onReady(function(){

var submitButton = new Ext.Button({
text: 'Next',
handler: function(){
cp.el.switchOff({
});
}
});

var cp = new Ext.Panel({
renderTo: 'myDiv',
padding: 5,
width: 500,
autoHeight: true,
html: Ext.Banner,
items: submitButton
});



});


My panel shows up fine, but the button is on the top of my html.

Anyone know why? I need it on the bottom. Also, how can I make my panel disappear without animation?

Thanks,
Micahel

MiamiCoder
7 May 2010, 11:13 AM
How about using the buttons config option?

LostSoul
7 May 2010, 12:06 PM
add a bbar[] to your panel

var cp = new Ext.Panel({
renderTo: 'myDiv',
padding: 5,
width: 500,
autoHeight: true,
html: Ext.Banner,
bbar:[submitButton]
});

Eugen_
8 May 2010, 9:09 AM
Also, how can I make my panel disappear without animation?
try this

cp.setVisible(false);

watrboy00
8 May 2010, 9:54 AM
Read the api docs. You cannot use the html and items config option at the same time. That being said there are many other approaches to do what you want. You can use a toolbar (either tbar or bbar) as pointed out by LostSoul or use the buttons config option like MiamiCoder said.