The HBox layout arranges items horizontally across a container. It optionally divides the available horizontal space between child items containing a flex
configuration, which is numeric. The flex
option
is a ratio that distributes the width after any items with explicit widths have been accounted for. We can either use the width
property to specify a fixed width or use flex
. This recipe describes how we can arrange our items using the hbox
layout.
Make sure that you have set up your development environment by following the recipes outlined in Chapter 1.
Carry out the following steps:
Create and open a new file named
ch03_07.js
and paste the following code into it:Ext.setup({ onReady: function() { var pnl = new Ext.Panel({ width: 400, height: 300, fullscreen: true, layout: 'hbox', items: [{ flex: 3, html: 'First', bodyStyle: 'background:grey;' ...