Mixing Dojo's BorderContainer with OneUI
Tue Jul 31 21:18:00 EDT 2012
Chris Toohey's post earlier today reminded me of a technique I've been using in some of my apps lately. Since most of what I've been doing has been for internal and admin/reporting-type apps, I've been using OneUI extensively - it's straightforward with the Extension Library, looks pretty good, and the consistency of UI works for that type of application.
However, I ran into a problem with large views: putting a very horizontally-large table into the content area of OneUI breaks it horribly, and there's no good fix. With a lot of tweaking, I made it so it at least scrolls and the header extends the full width, but it was still problematic, particularly when I wanted to add a right sidebar.
The solution I ended up going with was to graft the OneUI look onto a Dojo BorderContainer skeleton, since a BorderContainer takes care of overflowing content nicely. The end result works reasonably well:
The layout's code is not pretty, but it doesn't have to be. It provides to its children a couple content facets: the primary content area, LeftColumn, RightColumn, and ActionBar, which is pretty much like a Notes client action bar (my project that uses this takes a lot of cues from an existing Notes app). Additionally, it only shows those extra facets when there's something present, so the sidebars and action bar are entirely hidden when not needed. There are a couple caveats, though:
- It doesn't provide bindings for every property, as Chris Toohey's does. It certainly could - I just haven't had a need for it.
- Similarly, I don't have a need for the footer area, so that isn't included. However, it easily could be.
- It needs some stylesheet patching, and the current stylesheet I use has some flaws in non-Safari browsers (I'm still working on it).
- Since most of the OneUI structure is written out as HTML, it's not as convenient to tweak as the ExtLib's layout control.
Still, it's been working well for my purposes, and perhaps it'll be useful on its own or as a starting point for other projects.