Add form controls to center region : Border Layout « Ext JS « JavaScript DHTML






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

1.Border layout viewport
2.Set region for border layout
3.Set region height
4.Set region minHeight
5.Set region maxHeight
6.Set split: true,
7.Set collapsible : true
8.Set margin for region
9.Set content panel for region
10.Set border style for form panel
11.Complex border layout
12.Place elements to five parts of Border layout