- Ext.js - Home
- Ext.js - Overview
- Ext.js - Environment Setup
- Ext.js - Naming Convention
- Ext.js - Architecture
- Ext.js - First Program
- Ext.js - Class System
- Ext.js - Containers
- Ext.js - Layouts
- Ext.js - Components
- Ext.js - Drag & Drop
- Ext.js - Themes
- Ext.js - Custom Events and Listeners
- Ext.js - Data
- Ext.js - Fonts
- Ext.js - Style
- Ext.js - Drawing
- Ext.js - Localization
- Ext.js - Accessibility
- Ext.js - Debugging Code
- Ext.js - Methods
Ext.js - hbox Layout
Description
hbox : This layout allows the element to be distributed in the horizontal manner.
Syntax
Here is the simple syntax to use hbox layout
layout: 'hbox'
Example
Following is a simple example showing the usage of hbox layout
<!DOCTYPE html>
<html>
<head>
<link href="/?originalUrl=https%3A%2F%2Fcdnjs.cloudflare.com%2Fajax%2Flibs%2Fextjs%2F6.0.0%2Fclassic%2Ftheme-classic%2Fresources%2Ftheme-classic-all.css" rel="stylesheet" />
<script type="text/javascript" src="/?originalUrl=https%3A%2F%2Fcdnjs.cloudflare.com%2Fajax%2Flibs%2Fextjs%2F6.0.0%2Fext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
Ext.create('Ext.panel.Panel', {
renderTo : Ext.getBody(),
layout : {
type :'hbox'
},
requires: ['Ext.layout.container.HBox'],
xtype: 'layout-horizontal-box',
width : 600,
frame :true,
items : [{
title: 'Panel 1',
html : 'Panel with flex 1',
flex : 1
},{
title: 'Panel 2',
html : 'Panel with flex 2',
flex : 2
},{
title: 'Panel 3',
width: 150,
html : 'Panel with width 150'
},{
title: 'Panel 4',
html : 'Panel with flex 1',
flex : 1
}]
});
});
</script>
</head>
<body>
</body>
</html>
This will produce following result −
Advertisements