Login Register

BorderContainer (1.1)

New in 1.1

This widget is a container partitioned into up to five regions: left (or leading), right (or trailing), top, and bottom with a mandatory center to fill in any remaining space. Each edge region may have an optional splitter user interface for manual resizing. Note that there can be at most one child marked for each region.

Sizes are specified for the edge regions in pixels or percentage using CSS -- height to top and bottom, width for the sides. You might specify a top region of height:100px and a left region of width:50%. The center typically does not have any dimensions specified in CSS and resizes automatically to fill the remaining space.

BorderContainer operates in a choice of two layout modes: the design attribute may be set to "headline" (by default) or "sidebar". With the "headline" layout, the top and bottom sections extend the entire width of the box and the remaining regions are placed in the middle. With the "sidebar" layout, the side panels take priority, extending the full height of the box.

A simple layout with design="headline": (demo not functional yet)

The Dojo Book
Table of Contents



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Layout Container Demo 2</title>
    <style type="text/css">
        @import "http://o.aolcdn.com/dojo/1.1/dijit/themes/tundra/tundra.css";
        @import "http://o.aolcdn.com/dojo/1.1/dojo/resources/dojo.css"
    </style>
    <script type="text/javascript" src="http://o.aolcdn.com/dojo/1.1/dojo/dojo.xd.js"
        djConfig="parseOnLoad: true">
</script>
    <style> 
        /* NOTE: for a full screen layout, must set body size equal to the viewport. */
        html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
    </style>
    <script type="text/javascript">
        dojo.require("dojo.parser");
        dojo.require("dijit.layout.ContentPane");
        dojo.require("dijit.layout.BorderContainer");
     </script>
</head>
<body class="tundra">
<div dojoType="dijit.layout.BorderContainer" design="headline">
   <div dojoType="dijit.layout.ContentPane" region="top" style="background-color:red">
        The Dojo Book
   </div>
   <div dojoType="dijit.layout.ContentPane" region="left"
        style="background-color:lightblue;width: 120px;">

        Table of Contents
    </div>
    <div dojoType="dijit.layout.ContentPane" region="center"
        style="background-color:yellow">

            <blockquote><a href="../node/717">Introduction</a>
                <ol>
                    <li><a href="../node/718">Dojo: What is It?</a></li>
                    <li><a href="../node/719">History</a></li>
                    <li><a href="../node/733">What Dojo Gives You</a></li>
                </ol>
                </blockquote>
    </div>
</div>       
</body></html>

[TODO: sidebar demo]

Splitters can be enabled on any of the regions, except the center, by setting the "splitter" attribute on the child widget to true. "minSize" and "maxSize" attributes on the regions can specify constraints for the splitter in pixels. The "liveSplitters" attribute on the BorderContainer enables behavior where the splitter actively resizes the regions as the user moves the mouse. If set to false, the resize will only occur on mouse up.

[TODO: splitter demo]

The "persist" attribute makes it possible for the widget to remember the splitter positions from one session to the next using cookies.

BiDi considerations

Because this widget is BiDi aware, "leading" or "trailing" terminology may be used to indicate that the layout should be flipped horizontally for right-to-left rendering. "left" and "right" are absolute positions and will be unaffected by text direction.

Accessibility (a11y)

The children of BorderContainer must be listed in their natural tab order.

1.0 Migration Tips

This widget replaces the functionality of LayoutContainer and SplitContainer. The most important things to note when migrating your code from these widgets are:

  • LayoutContainer.layoutAlign attribute corresponds to BorderContainer.region
  • What LayoutContainer called the "client" region, BorderContainer calls "center"
  • There must be at least one child marked as region="center"
  • sizeShare is no longer supported. Specify the pane sizes using CSS instead as pixels or percentages.

Unlike LayoutContainer, BorderContainer does not allow for multiple widgets to be placed in a given position (e.g. inner left and outer left, patterned after Delphi) In order to achieve this, nested BorderContainers must be used.

Also, while you can specify sizes in percentages, these are only initial sizes, so setting left and right to 33% will split the children across into thirds, but resizing will allow the center to grow or shrink while the sizes remain fixed. There currently is no widget to provide equal layout, although HTML Tables may serve this purpose.

HOW TO USE IT

Can any one explain me how to use BorderContainer.

Example in IE7

I copied the exact example above.
Run it in Tomcat 5.

In IE7 I see shortly the output and then it dissappears (?)
Tried this on XP and Vista.
In FF it is fine.

What am I missing in my code. Its the exact sample above.

doctype

When I remove the DOCTYPE, it displays fine in IE7

navigation in Book of Dojo

This page, on BorderContainer, is not listed in the left
Nav column under Layout. That makes it quite a bit harder to find.

Tree widget does not work in a border container

I tried putting a tree in the left region of a border layout - and it doesn't work. It doesn't show the child nodes.

progromatic example

any chance of seeing a programatic example for creating a border-container and content pane children.
Something like http://download.dojotoolkit.org/current-stable/dojo-release-1.1.0/dijit/...
would be great.

Everything dissappears after resize

Hi,

I tried out the example above and it works fine when loaded. The problem is when I resize the window, after that everything dissappears and the page becomes blank. This happens on Firefox 2.0.0.14 and the page is running on Tomcat 6.

After delteting the DOCTYPE tag (as suggested above) the page is shown fine on IE7, also after resize.

Any ideas and solutions of that problem? (I'm using some plugins wiht Firefox like Firebug and WebDeveloper, but it doesn't work even if they are disabled)

Everything disappears

Hi,

I had a similar problem on FF.
I managed to get it running by explicitly setting the width and height of the BorderContainer
<div dojoType="dijit.layout.BorderContainer" style="width: 100%; height: 100%;" >...</div>

Marco

BorderContainer does not support full size of width in IE6

Hi,

I find that the top region does not fully match the width of IE6 browser, but work in FF2. The code is as follows:

The Dojo Header
The Dojo Content

Do anyone tell me how to solve it?

Kenneth

Re: BorderContainer does not support full size of width in IE6

Sorry. I solved it.

I missed to add the style in header

html, body { height: 100%; width: 100%; margin: 0; padding: 0; }

style sheets out of order

I had the same problem with the page in the example disappearing shortly after load.

If I swap the order of the style sheets so that dojo.css is first and tundra.css is second it works fine.

How to make the layout look beautifual?

Like the Demo "mail" , the background of each ContainerPane are very good.

Doesn't work

Hello All,

When I put a reference to a theme with css (soria, tundra,...) all desappear...

Any idea to help me ?

This is my code (I use the documentation to start it)
If you uncomment "@import './js/dijit/themes/soria/soria.css';" all desappear, I got a blank page.

For a better view of the problem :

http://babygest.free.fr/noindex.html (the page with a theme, nothing is visible)
http://babygest.free.fr/index.html (the page without a theme, all is visible) (only comment the css soria)

this is my css :

/*@import "./js/dijit/themes/soria/soria.css";*/
        @import "./js/dojo/resources/dojo.css";

and

html, body {
                  height: 100%; width: 100%; margin: 0; padding: 0;
                }

this is my html :

<div dojoType="dijit.layout.BorderContainer" design="headline">
   <div dojoType="dijit.layout.ContentPane" region="top" style="background-color:red">
        The Dojo Book
   </div>
   <div dojoType="dijit.layout.ContentPane" region="left" style="background-color:lightblue;width: 120px;">
        Menu
                <div dojoType="dojo.data.ItemFileReadStore" url="./poptarts.txt" jsid="popStore"></div>
        <div dojoType="dijit.Tree" store="popStore" labelAttr="name" label="Pop Tarts"></div>
    </div>
    <div dojoType="dijit.layout.ContentPane" region="center"
        style="background-color:yellow">

            <blockquote><a href="../node/717">Introduction</a>
                <ol>
                    <li><a href="../node/718">Dojo: What is It?</a></li>
                    <li><a href="../node/719">History</a></li>
                    <li><a href="../node/733">What Dojo Gives You</a></li>
                </ol>
                </blockquote>
    </div>
        <div dojoType="dijit.layout.ContentPane" region="bottom" style="background-color:red">
        The Dojo Book
   </div>
</div>

--
Cyril CHARLIER

watch order of css

somebody else here stated that dojo.css must come first.

I can confirm this for Firefox 3.0.3.

After fixing this the layout rendered.

Peter

One error occured while loading this page

this page can not be displayed correctly.the borderContainer demo doesn't look fine.

a 404 error occured, file
http://dojotoolkit.org/sites/all/modules/dojo/dtk_build/dijit/layout/Bor...
can not found

BorderContainer in dojo-1.2.0

so... due to some post(http://dojotoolkit.org/forum/dijit-dijit-0-9/dijit-support/bordercontain...). does Dojo-1.2.0 give BorderContainer up?

Can the children of BorderConainer be any widget?

Can the children be any widget (as opposed to ContentPanes)? I've had some luck in doing this with some standard widgets and a few of my custom widgets; but for other customs widgets it fails with errors like "pe is not defined" or "size is not defined". All my custom widgets inherit from _Widget. Is this supposed to work, or is it a fluke that it works for any of them?

sidebar attribute is OK with v1.1.1, but not OK with v1.2.0!

sidebar attribute of borderContainer doesn't work for v1.2.0, but works for 1.1.1.
Since I roll back to the 1.1.1, it works.

Also, another evidence.
It's OK with 1.1.1
http://download.dojotoolkit.org/release-1.1.1/dojo-release-1.1.1/dijit/t...

but it isn't OK with 1.2.0.
http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/layout/te...
(this issue with this URL seems been solved now.)