tags:

views:

191

answers:

1

I've had some experience in Swing and now I'm trying my hand at writing an ajax app in dojo. I'm particularly having a problem with layout. In Swing I'm used to putting widgets in containers with layout managers for simple things like left-to-right layout to more complicated things like 4 border regions and a center region.

After using Dojo for a bit I see there is a border type layout, but I don't see layouts for simpler things like left-to-right and top-to-bottom. There's a scrolling pane, but I don't want/need a scrollbar.

In my old-school web days, I used tables for layout, but after reading many posts about the "incorrectness" of such an approach I'm expecting the universe to explode if I employ this technique now =).

I've got to be missing something in Dojo... or maybe there's a general "web-way" of doing such things that is not specific to Dojo.

+1  A: 

Dijit only provides a handful of layout widgets, and most of them are 'stack' based: StackContainer, AccordionContainer, and TabContainer are all about putting widgets on top of each other and switching between them. BorderContainer does what you describe and is generally the most useful layout widget in Dojo. dojox.layout has a few more.

The general philosophy of Dijit is to use HTML and the browser's native layout engine for anything HTML can do. Left to right is probably just putting widgets inline in HTML flow, top bottom would be separating them by block elements. Basic CSS can be applied for padding, etc. Absolute CSS positioning should be avoided. TABLEs are still your best bet for matrix layout to run well on all browsers -- nothing will blow up, just try not do nest them too much. There are fancier CSS layout techniques coming, but I don't think they're well supported yet.

peller