O'Reilly logo

Ext JS 4 Web Application Development Cookbook by Stuart Ashworth, Andrew Duncan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using a FitLayout to expand components to fill their parent

The FitLayout makes it possible for you to expand a component to fill its parent container. The FitLayout is easy to use and requires no configuration. The screenshot shows how a FitLayout can be used to automatically expand a panel to take up its parent's entire area:

Using a FitLayout to expand components to fill their parent

How to do it...

  1. Start by creating a simple Ext.panel.Panel and render it to the document's body. This panel will be the parent item that contains our inner, expanded-to-fit component:
    Ext.create('Ext.panel.Panel', {
        title: 'Fit Layout',
        width: 500,
        height: 200,
        renderTo: Ext.getBody()
    });
  2. Now, add the inner panel by adding it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required