JavaScript DHTML/Ext JS/HBox Layout — различия между версиями

Материал из Web эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 07:21, 26 мая 2010

A Container with an HBox layout

  
<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.Window({
           layout       : "hbox",                                              
           height       : 300, 
           width        : 300, 
           title        : "A Container with an HBox layout",
           layoutConfig : {                                                   
              pack : "start"
           },   
           defaults : {
              frame : true,
           },   
           items : [
              {         
                 title  : "Panel 1",
                 height : 100   
              },        
              {         
                 title  : "Panel 2",
                 height : 75,   
                 width  : 100
              },
              {
                 title  : "Panel 3",
                 height : 200
              }
           ]
        }).show();

});
</script> 
<div id="div1">asdf</div>
</body>
</html>



A hbox layout

  
<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() {
    
        var myWin = new Ext.Window({
          height       : 300,
          width        : 300,
          border       : false,
          autoScroll   : true,
          id           : "myWin",
          title        : "A hbox layout",
          layout       : "hbox",
          layoutConfig : {
            align        : "stretch"
          },
          defaults     : {
            frame : true
          },
          items        : [
            {
              title       : "Column 1",
              html        : "1",
              id          : "col1"
              
            },
            {
              title       : "Column 2",
              html        : "2",
            },
            {
              title : "Col 3",
              html  : "",
              width : 100
            },
            {
              title       : "Col 4",
              frame       : true
            }
          ]
          
        });
        
        myWin.show();

});
</script> 
<div id="div1">asdf</div>
</body>
</html>



Align middle hbox layout

  
<!--
/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.ru
 * http://www.extjs.ru/license
 */
-->
<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>
<!-- Revised from demo code in ext3.0.0 -->
<body>
<script type="text/javascript">
        Ext.onReady(function() {
            var replace = function(config){
                var btns = Ext.getCmp("btns");
                btns.remove(0);
                btns.add(Ext.apply(config, {
                    layout:"hbox"
                }));
                btns.doLayout();
            }

            var viewport = new Ext.Viewport({
                layout:"border",
                items: [{
                    id:"btns",
                    region:"north",
                    baseCls:"x-plain",
                    split:true,
                    height:50,
                    minHeight: 40,
                    maxHeight: 85,
                    layout:"fit",
                    margins: "5 5 0 5",
                    items: {
                        baseCls: "x-plain",
                        html: "<p style="padding:10px;color:#556677;">Select a configuration below:</p>"
                    }
               }, {
                    region:"center",
                    margins: "0 5 5 5",
                    layout:"anchor",
                    items:[{
                        anchor:"100%",
                        baseCls:"x-plain",
                        layout:"hbox",
                        layoutConfig: {
                            padding: 10
                        },
                        defaults:{
                            margins:"0 5 0 0",
                            pressed: false,
                            toggleGroup:"btns",
                            allowDepress: false
                        },
                        items: [{
                            xtype:"button",
                            text: "Align: middle",
                            handler: function(){
                                replace({
                                    layoutConfig: {
                                        padding:"5",
                                        align:"middle"
                                    },
                                    defaults:{margins:"0 5 0 0"},
                                    items:[{
                                        xtype:"button",
                                        text: "Button 1"
                                    },{
                                        xtype:"button",
                                        text: "Button 2"
                                    },{
                                        xtype:"button",
                                        text: "Button 3"
                                    },{
                                        xtype:"button",
                                        text: "Button 4"
                                    }]
                                });
                            }
                        }]
                    }]
                }]
            });
        });
    </script>
        
</script>
</body>
</html>



Align stretch hbox layout

  
<!--
/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.ru
 * http://www.extjs.ru/license
 */
-->
<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>
<!-- Revised from demo code in ext3.0.0 -->
<body>
<script type="text/javascript">
        Ext.onReady(function() {
            var replace = function(config){
                var btns = Ext.getCmp("btns");
                btns.remove(0);
                btns.add(Ext.apply(config, {
                    layout:"hbox"
                }));
                btns.doLayout();
            }

            var viewport = new Ext.Viewport({
                layout:"border",
                items: [{
                    id:"btns",
                    region:"north",
                    baseCls:"x-plain",
                    split:true,
                    height:50,
                    minHeight: 40,
                    maxHeight: 85,
                    layout:"fit",
                    margins: "5 5 0 5",
                    items: {
                        baseCls: "x-plain",
                        html: "<p style="padding:10px;color:#556677;">Select a configuration below:</p>"
                    }
               }, {
                    region:"center",
                    margins: "0 5 5 5",
                    layout:"anchor",
                    items:[{
                        anchor:"100%",
                        baseCls:"x-plain",
                        layout:"hbox",
                        layoutConfig: {
                            padding: 10
                        },
                        defaults:{
                            margins:"0 5 0 0",
                            pressed: false,
                            toggleGroup:"btns",
                            allowDepress: false
                        },
                        items: [{
                            xtype:"button",
                            text: "Align: stretch",
                            handler: function(){
                                replace({
                                    layoutConfig: {
                                        padding:"5",
                                        align:"stretch"
                                    },
                                    defaults:{margins:"0 5 0 0"},
                                    items:[{
                                        xtype:"button",
                                        text: "Button 1"
                                    },{
                                        xtype:"button",
                                        text: "Button 2"
                                    },{
                                        xtype:"button",
                                        text: "Button 3"
                                    },{
                                        xtype:"button",
                                        text: "Button 4"
                                    }]
                                });
                            }
                        }]
                    }]
                }]
            });
        });
    </script>
        
</script>
</body>
</html>



Align: stretchmax hbox layout

  
<!--
/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.ru
 * http://www.extjs.ru/license
 */
-->
<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>
<!-- Revised from demo code in ext3.0.0 -->
<body>
<script type="text/javascript">
        Ext.onReady(function() {
            var replace = function(config){
                var btns = Ext.getCmp("btns");
                btns.remove(0);
                btns.add(Ext.apply(config, {
                    layout:"hbox"
                }));
                btns.doLayout();
            }

            var viewport = new Ext.Viewport({
                layout:"border",
                items: [{
                    id:"btns",
                    region:"north",
                    baseCls:"x-plain",
                    split:true,
                    height:50,
                    minHeight: 40,
                    maxHeight: 85,
                    layout:"fit",
                    margins: "5 5 0 5",
                    items: {
                        baseCls: "x-plain",
                        html: "<p style="padding:10px;color:#556677;">Select a configuration below:</p>"
                    }
               }, {
                    region:"center",
                    margins: "0 5 5 5",
                    layout:"anchor",
                    items:[{
                        anchor:"100%",
                        baseCls:"x-plain",
                        layout:"hbox",
                        layoutConfig: {
                            padding: 10
                        },
                        defaults:{
                            margins:"0 5 0 0",
                            pressed: false,
                            toggleGroup:"btns",
                            allowDepress: false
                        },
                        items: [{
                            xtype:"button",
                            text: "Align: stretchmax",
                            handler: function(){
                                replace({
                                    layoutConfig: {
                                        padding:"5",
                                        align:"stretchmax"
                                    },
                                    defaults:{margins:"0 5 0 0"},
                                    items:[{
                                        xtype:"button",
                                        text: "Button 1"
                                    },{
                                        xtype:"button",
                                        text: "Button 2"
                                    },{
                                        xtype:"button",
                                        text: "Button 3"
                                    },{
                                        xtype:"button",
                                        text: "Button 4"
                                    }]
                                });
                            }
                        }]
                    }]
                }]
            });
        });
    </script>
        
</script>
</body>
</html>



Align top hbox layout

  
<!--
/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.ru
 * http://www.extjs.ru/license
 */
-->
<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>
<!-- Revised from demo code in ext3.0.0 -->
<body>
<script type="text/javascript">
        Ext.onReady(function() {
            var replace = function(config){
                var btns = Ext.getCmp("btns");
                btns.remove(0);
                btns.add(Ext.apply(config, {
                    layout:"hbox"
                }));
                btns.doLayout();
            }

            var viewport = new Ext.Viewport({
                layout:"border",
                items: [{
                    id:"btns",
                    region:"north",
                    baseCls:"x-plain",
                    split:true,
                    height:50,
                    minHeight: 40,
                    maxHeight: 85,
                    layout:"fit",
                    margins: "5 5 0 5",
                    items: {
                        baseCls: "x-plain",
                        html: "<p style="padding:10px;color:#556677;">Select a configuration below:</p>"
                    }
               }, {
                    region:"center",
                    margins: "0 5 5 5",
                    layout:"anchor",
                    items:[{
                        anchor:"100%",
                        baseCls:"x-plain",
                        layout:"hbox",
                        layoutConfig: {
                            padding: 10
                        },
                        defaults:{
                            margins:"0 5 0 0",
                            pressed: false,
                            toggleGroup:"btns",
                            allowDepress: false
                        },
                        items: [{
                            xtype:"button",
                            text: "Align: top",
                            handler: function(){
                                replace({
                                    layoutConfig: {
                                        padding:"5",
                                        align:"top"
                                    },
                                    defaults:{margins:"0 5 0 0"},
                                    items:[{
                                        xtype:"button",
                                        text: "Button 1"
                                    },{
                                        xtype:"button",
                                        text: "Button 2"
                                    },{
                                        xtype:"button",
                                        text: "Button 3"
                                    },{
                                        xtype:"button",
                                        text: "Button 4"
                                    }]
                                });
                            }
                        }]
                    }]
                }]
            });
        });
    </script>
        
</script>
</body>
</html>



Flex: All even (hbox layout)

  

<!--
/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.ru
 * http://www.extjs.ru/license
 */
-->
<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>
<!-- Revised from demo code in ext3.0.0 -->
<body>
<script type="text/javascript">
        Ext.onReady(function() {
            var replace = function(config){
                var btns = Ext.getCmp("btns");
                btns.remove(0);
                btns.add(Ext.apply(config, {
                    layout:"hbox"
                }));
                btns.doLayout();
            }

            var viewport = new Ext.Viewport({
                layout:"border",
                items: [{
                    id:"btns",
                    region:"north",
                    baseCls:"x-plain",
                    split:true,
                    height:50,
                    minHeight: 40,
                    maxHeight: 85,
                    layout:"fit",
                    margins: "5 5 0 5",
                    items: {
                        baseCls: "x-plain",
                        html: "<p style="padding:10px;color:#556677;">Select a configuration below:</p>"
                    }
               }, {
                    region:"center",
                    margins: "0 5 5 5",
                    layout:"anchor",
                    items:[{
                        anchor:"100%",
                        baseCls:"x-plain",
                        layout:"hbox",
                        layoutConfig: {
                            padding: 10
                        },
                        defaults:{
                            margins:"0 5 0 0",
                            pressed: false,
                            toggleGroup:"btns",
                            allowDepress: false
                        },
                        items: [{
                            xtype:"button",
                            text: "Flex: All even",
                            handler: function(){
                                replace({
                                    layoutConfig: {
                                        padding:"5",
                                        align:"middle"
                                    },
                                    defaults:{margins:"0 5 0 0"},
                                    items:[{
                                        xtype:"button",
                                        text: "Button 1",
                                        flex:1
                                    },{
                                        xtype:"button",
                                        text: "Button 2",
                                        flex:1
                                    },{
                                        xtype:"button",
                                        text: "Button 3",
                                        flex:1
                                    },{
                                        xtype:"button",
                                        text: "Button 4",
                                        flex:1,
                                        margins:"0"
                                    }]
                                });
                            }
                        }]
                    }]
                }]
            });
        });
    </script>
        
</script>
</body>
</html>



Flex: Ratio (hbox layout)

  
<!--
/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.ru
 * http://www.extjs.ru/license
 */
-->
<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>
<!-- Revised from demo code in ext3.0.0 -->
<body>
<script type="text/javascript">
        Ext.onReady(function() {
            var replace = function(config){
                var btns = Ext.getCmp("btns");
                btns.remove(0);
                btns.add(Ext.apply(config, {
                    layout:"hbox"
                }));
                btns.doLayout();
            }

            var viewport = new Ext.Viewport({
                layout:"border",
                items: [{
                    id:"btns",
                    region:"north",
                    baseCls:"x-plain",
                    split:true,
                    height:50,
                    minHeight: 40,
                    maxHeight: 85,
                    layout:"fit",
                    margins: "5 5 0 5",
                    items: {
                        baseCls: "x-plain",
                        html: "<p style="padding:10px;color:#556677;">Select a configuration below:</p>"
                    }
               }, {
                    region:"center",
                    margins: "0 5 5 5",
                    layout:"anchor",
                    items:[{
                        anchor:"100%",
                        baseCls:"x-plain",
                        layout:"hbox",
                        layoutConfig: {
                            padding: 10
                        },
                        defaults:{
                            margins:"0 5 0 0",
                            pressed: false,
                            toggleGroup:"btns",
                            allowDepress: false
                        },
                        items: [{
                            xtype:"button",
                            text: "Flex: Ratio",
                            handler: function(){
                                replace({
                                    layoutConfig: {
                                        padding:"5",
                                        align:"middle"
                                    },
                                    defaults:{margins:"0 5 0 0"},
                                    items:[{
                                        xtype:"button",
                                        text: "Button 1",
                                        flex:1
                                    },{
                                        xtype:"button",
                                        text: "Button 2",
                                        flex:1
                                    },{
                                        xtype:"button",
                                        text: "Button 3",
                                        flex:1
                                    },{
                                        xtype:"button",
                                        text: "Button 4",
                                        flex:3,
                                        margins:"0"
                                    }]
                                });
                            }
                        }]
                    }]
                }]
            });
        });
    </script>
        
</script>
</body>
</html>



HBox layout, align : "middle"

  
<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.Window({
        layout       : "hbox",
        height       : 300,
        width        : 300,
      title        : "An HBox layout",
        layoutConfig : {
          pack : "center",
        align : "middle"
      },
        defaults : {
            frame : true,
        },
        items : [
            {
                title : "Panel 1",
                
            },
            {
                title : "Panel 2",
                
            },
            {
                title : "Panel 3",
               
            },
        ]
    }).show();

});
</script> 
<div id="div1">asdf</div>
</body>
</html>



HBox layout, align : "stretch"

  
<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.Window({
      layout       : "hbox",
      height       : 250,
      width        : 250,
      title        : "HBox layout",
      layoutConfig : {
        align : "stretch"
      },
      defaults : {
        frame : true,
      },
      items : [
        {
          title  : "Panel 1",
          flex   : 1
        },
        {
          title  : "Panel 2",
          width  : 100,
          flex : 1
        },
        {
          title  : "Panel 3",
          flex   : 1
        }
      ]
    }).show();

});
</script> 
<div id="div1">asdf</div>
</body>
</html>



hbox layout and pack = "start"

  
<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.Window({
           layout       : "hbox",                                              
           height       : 300, 
           width        : 300, 
           title        : "A Container with an HBox layout",
           layoutConfig : {                                                   
              pack : "start"
           },   
           defaults : {
              frame : true,
           },   
           items : [
              {         
                 title  : "Panel 1",
                 height : 100   
              },        
              {         
                 title  : "Panel 2",
                 height : 75,   
                 width  : 100
              },
              {
                 title  : "Panel 3",
                 height : 200
              }
           ]
        }).show();

});
</script> 
<div id="div1">asdf</div>
</body>
</html>



HBox layout, width and height

  
<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.Window({
      layout       : "hbox",
      height       : 250,
      width        : 250,
      title        : "HBox layout",
      layoutConfig : {
        pack : "start",
        align : "middle"
      },
      defaults : {
        frame : true,
      },
      items : [
        {
          title  : "Panel 1",
          height : 100
        },
        {
          title  : "Panel 2",
          height : 75,
          width  : 100
        },
        {
          title  : "Panel 3",
          height : 200
        }
      ]
    }).show();

});
</script> 
<div id="div1">asdf</div>
</body>
</html>



HBox layout with three panels

  <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.Window({
       layout       : "vbox",                                             
       height       : 300, 
       width        : 300, 
       title        : "A Container with an HBox layout",
       layoutConfig : {                                                    
          pack   : "start"
       },   
       defaults : {
          frame : true,
       },   
       items : [
          {         
             title  : "Panel 1",
             width : 100   
          },        
          {         
             title  : "Panel 2",
             width  : 75,   
             height : 100
          },
          {
             title  : "Panel 3",
             width  : 200
          }
       ]
    }).show();

});
</script> 
<div id="div1">asdf</div>
</body>
</html>



Pack: center (hbox layout)

  
<!--
/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.ru
 * http://www.extjs.ru/license
 */
-->
<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>
<!-- Revised from demo code in ext3.0.0 -->
<body>
<script type="text/javascript">
        Ext.onReady(function() {
            var replace = function(config){
                var btns = Ext.getCmp("btns");
                btns.remove(0);
                btns.add(Ext.apply(config, {
                    layout:"hbox"
                }));
                btns.doLayout();
            }

            var viewport = new Ext.Viewport({
                layout:"border",
                items: [{
                    id:"btns",
                    region:"north",
                    baseCls:"x-plain",
                    split:true,
                    height:50,
                    minHeight: 40,
                    maxHeight: 85,
                    layout:"fit",
                    margins: "5 5 0 5",
                    items: {
                        baseCls: "x-plain",
                        html: "<p style="padding:10px;color:#556677;">Select a configuration below:</p>"
                    }
               }, {
                    region:"center",
                    margins: "0 5 5 5",
                    layout:"anchor",
                    items:[{
                        anchor:"100%",
                        baseCls:"x-plain",
                        layout:"hbox",
                        layoutConfig: {
                            padding: 10
                        },
                        defaults:{
                            margins:"0 5 0 0",
                            pressed: false,
                            toggleGroup:"btns",
                            allowDepress: false
                        },
                        items: [{
                            xtype:"button",
                            text: "Pack: center",
                            handler: function(){
                                replace({
                                    layoutConfig: {
                                        padding:"5",
                                        pack:"center",
                                        align:"middle"
                                    },
                                    defaults:{margins:"0 5 0 0"},
                                    items:[{
                                        xtype:"button",
                                        text: "Button 1"
                                    },{
                                        xtype:"button",
                                        text: "Button 2"
                                    },{
                                        xtype:"button",
                                        text: "Button 3"
                                    },{
                                        xtype:"button",
                                        text: "Button 4",
                                        margins:"0"
                                    }]
                                });
                            }
                        }]
                    }]
                }]
            });
        });
    </script>
        
</script>
</body>
</html>



Pack: start (hbox layout)

  
<!--
/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.ru
 * http://www.extjs.ru/license
 */
-->
<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>
<!-- Revised from demo code in ext3.0.0 -->
<body>
<script type="text/javascript">
        Ext.onReady(function() {
            var replace = function(config){
                var btns = Ext.getCmp("btns");
                btns.remove(0);
                btns.add(Ext.apply(config, {
                    layout:"hbox"
                }));
                btns.doLayout();
            }

            var viewport = new Ext.Viewport({
                layout:"border",
                items: [{
                    id:"btns",
                    region:"north",
                    baseCls:"x-plain",
                    split:true,
                    height:50,
                    minHeight: 40,
                    maxHeight: 85,
                    layout:"fit",
                    margins: "5 5 0 5",
                    items: {
                        baseCls: "x-plain",
                        html: "<p style="padding:10px;color:#556677;">Select a configuration below:</p>"
                    }
               }, {
                    region:"center",
                    margins: "0 5 5 5",
                    layout:"anchor",
                    items:[{
                        anchor:"100%",
                        baseCls:"x-plain",
                        layout:"hbox",
                        layoutConfig: {
                            padding: 10
                        },
                        defaults:{
                            margins:"0 5 0 0",
                            pressed: false,
                            toggleGroup:"btns",
                            allowDepress: false
                        },
                        items: [{
                            xtype:"button",
                            text: "Pack: start",
                            handler: function(){
                                replace({
                                    layoutConfig: {
                                        padding:"5",
                                        pack:"start",
                                        align:"middle"
                                    },
                                    defaults:{margins:"0 5 0 0"},
                                    items:[{
                                        xtype:"button",
                                        text: "Button 1"
                                    },{
                                        xtype:"button",
                                        text: "Button 2"
                                    },{
                                        xtype:"button",
                                        text: "Button 3"
                                    },{
                                        xtype:"button",
                                        text: "Button 4"
                                    }]
                                });
                            }
                        }]
                    }]
                }]
            });
        });
    </script>
        
</script>
</body>
</html>



Spaced hbox layout

  
<!--
/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.ru
 * http://www.extjs.ru/license
 */
-->
<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>
<!-- Revised from demo code in ext3.0.0 -->
<body>
<script type="text/javascript">
        Ext.onReady(function() {
            var replace = function(config){
                var btns = Ext.getCmp("btns");
                btns.remove(0);
                btns.add(Ext.apply(config, {
                    layout:"hbox"
                }));
                btns.doLayout();
            }

            var viewport = new Ext.Viewport({
                layout:"border",
                items: [{
                    id:"btns",
                    region:"north",
                    baseCls:"x-plain",
                    split:true,
                    height:50,
                    minHeight: 40,
                    maxHeight: 85,
                    layout:"fit",
                    margins: "5 5 0 5",
                    items: {
                        baseCls: "x-plain",
                        html: "<p style="padding:10px;color:#556677;">Select a configuration below:</p>"
                    }
               }, {
                    region:"center",
                    margins: "0 5 5 5",
                    layout:"anchor",
                    items:[{
                        anchor:"100%",
                        baseCls:"x-plain",
                        layout:"hbox",
                        layoutConfig: {
                            padding: 10
                        },
                        defaults:{
                            margins:"0 5 0 0",
                            pressed: false,
                            toggleGroup:"btns",
                            allowDepress: false
                        },
                        items: [{
                            xtype:"button",
                            text: "Spaced",
                            handler: function(){
                                replace({
                                    layoutConfig: {
                                        padding:"5",
                                        align:"top"
                                    },
                                    defaults:{margins:"0 5 0 0"},
                                    items:[{
                                        xtype:"button",
                                        text: "Button 1"
                                    },{
                                        xtype:"spacer",
                                        flex:1
                                    },{
                                        xtype:"button",
                                        text: "Button 2"
                                    },{
                                        xtype:"button",
                                        text: "Button 3"
                                    },{
                                        xtype:"button",
                                        text: "Button 4",
                                        margins:"0"
                                    }]
                                });
                            }
                        }]
                    }]
                }]
            });
        });
    </script>
        
</script>
</body>
</html>