PDA

View Full Version : button on viewport



TheMonolith
19 Feb 2010, 12:40 AM
Hello,
I tried several ways to place an ordinary button on a viewport that covers the entire window area. My last attempt looks like this:



Ext.onReady(function(){

/* create purple viewport that covers the full window area */

var myViewport = new Ext.Viewport({
layout: 'fit',
defaults: {
bodyStyle: 'background-color: #800080; padding:10px'
},
items: [{
html: 'Panel using FitLayout'
}]
});

/* add button to viewport */

var myButton = new Ext.Button({
text: 'bla',
renderTo: 'myViewport'
});
});
Why is it not working and how do I make it work?

evant
19 Feb 2010, 12:52 AM
Ext.onReady(function(){

var myButton = new Ext.Button({
text: 'bla',
});

var myViewport = new Ext.Viewport({
layout: 'fit',
defaults: {
bodyStyle: 'background-color: #800080; padding:10px'
},
items: myButton
});
});



Only ever render the outermost component (the viewport renders itself automatically).