Add form controls to center region
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
</head>
<body>
<script type="text/javascript">
Ext.onReady(function() {
new Ext.Viewport({
layout : 'border',
defaults : {
frame : true,
split : true
},
items : [
{
xtype : 'container',
region : 'center',
layout : 'fit',
id : 'centerRegion',
autoEl : {},
items : {
title : 'Center Region',
id : 'centerPanel',
html : 'I am disposable',
frame : true
}
}
]
});
(function() {
var centerPanel = Ext.getCmp('centerPanel');
var centerRegion = Ext.getCmp('centerRegion');
centerRegion.remove(centerPanel, true);
centerRegion.add({
xtype : 'form',
frame : true,
bodyStyle : 'padding: 5px',
defaultType : 'field',
title : 'Please enter some information',
defaults : {
anchor : '-10',
},
items : [
{
fieldLabel : 'First Name'
},
{
fieldLabel : 'Last Name'
},
{
xtype : 'textarea',
fieldLabel : 'Comment'
}
]
});
centerRegion.doLayout();
}).defer(1000);
});
</script>
<div id='div1'>asdf</div>
</body>
</html>
Related examples in the same category