2

Is there a way to implement vertical layout using Dojo/Dijit? I don't like BorderLayout because of the splitters.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
  • BorderContainer provides the option to turn off splitters as well as "gutters" but still you'd be limited to three stacked elements. Like missingno says, simply stacking elements is best left to HTML, which is why Dijit doesn't provide hbox/vbox type widgets. – peller Aug 30 '11 at 04:40

1 Answers1

4

Unless you really need some particular feature (that you did not mention) from BorderLayout it might be possible to just use plain old HTML+CSS & DOM manipulation instead:

var d = dojo.create('div', {}, parentNode);
d.appendChild(aWidget.domNode);
d.appendChild(dojo.create('div', {innerHTML: 'a plain HTML node'}));
d.appendChild(anotherWidget.domNode);
//...

EDIT: I just came across a case where I actually wanted a VerticalLayout, due to some code operating on the addChild and removeChild functions. I managed to implement it by just mixing in some existing classes:

var VerticalLayout = dojo.declare([dijit._Widget, dijit._Container], {});
hugomg
  • 68,213
  • 24
  • 160
  • 246
  • Bloody brilliant! That works much better than hacking together HTML attributes with dojo.create(...) or worse. – Justin Jul 10 '12 at 01:31