Author Archive

Managing Widget Templates in Dojo 1.4

Wednesday, January 20th, 2010

This article introduces dojo.cache and presents a technique for externalizing your widget templates in swappable configuration files, where they can be referenced by a custom templateKey widget property.

Introducing dojo.cache

Dojo 1.4 adds a new core utility called dojo.cache. To appreciate it we first have to review how Dijit’s templatePath works. When you define a _Templated widget with a templatePath property, the content from that URL is fetched the first time you instantiate the widget, and made available as a string. All subsequent instances get the cached string. Furthermore, when you run a build, your templatePaths get replaced with templateStrings and their content is inlined into the output from the build. This improves performance considerably by removing those synchronous XHR requests, while remaining transparent to the developer.

dojo.cache generalizes this pattern, making the same functionality available from Dojo Core—synchronous, cached content retrieval that gets inlined during the build. dojo.cache usage is much like dojo.moduleUrl:

dojo.require("dojo.cache");
my.stringResource = dojo.cache("module.path", "relative.path.html" );

(more…)

Your business is important to us. Please wait

Thursday, August 13th, 2009

Interacting with a web application is a conversation. The user interface is your company’s proxy, it communicates on your behalf and just like a real conversation, you communicate as much with your body language as with the words you exchange. Good visual design can provide the right setting for this conversation, but interaction is the body language in this analogy. And one of the defining characteristics of good interaction is responsiveness.

(more…)

Dynamic Stylesheets, Part 1

Friday, March 13th, 2009

New to Dojo 1.2+ is dojox.html.style. This is a collection of methods which give you the ability to query the stylesheets collection in a document, add and remove rules, and dynamically create new sheets. In this article I’ll explain why and where this is of use, and walk through a split-panel demo that uses dynamic stylesheets to size a 2 column layout.

(more…)

Patching Dojo

Wednesday, February 4th, 2009

There are many reasons you might end up needing to patch your Dojo source tree. Maintaining patches can be a pain, and sometimes outside of your control entirely. It could be a bug you’ve found, or something you really wish a Dojo component did/didn’t do, or you are having to work against an older release of Dojo, or there’s a patch in trac that fixes an issue you have, but it has not yet been committed. In this post, we’ll present a neat way to make the change, keep what you did explicit so other developers aren’t confused, and maintain it outside the Dojo source.

(more…)

HTTP Proxying to Solve Web Development Problems

Wednesday, October 8th, 2008

An HTTP Proxy server relays requests between the HTTP client (e.g. your browser) and the server—whether it be out on the web, intranet or localhost. When it’s under your control, the proxy is a great place to inspect and debug client-server interactions over HTTP, log and report, tune and tamper with the requests the client makes, and the responses the server(s) produce. In this article I’ll show how to use Charles (one such proxy tool) to help solve a range of common web, and especially RIA, development problems.

(more…)

Building on AIR: Working with the Sandbox Bridges

Thursday, August 21st, 2008

The AIR platform defines distinct sandboxes for trusted and untrusted code, and provides a way to talk securely between each sandbox via sandbox “bridges”. This is a lynch-pin in the web-meets-desktop strategy that AIR embodies, but it can also present some of the trickier development challenges, with plenty of head-banging opportunity. I’ll share a few tips to help you avoid those head/keyboard collisions.

(more…)

The Devil’s in the Details: Fixing Dojo’s Toolbar Buttons

Wednesday, May 14th, 2008

The 1.2 release of the Dojo Toolkit is focused on the overall Look and Feel. Patches have been landing thick and fast to tighten up the visual polish. Most you might be hard-pressed to notice at first glance, but the devil is always in the details, and for a toolkit with the promise and scope of Dojo we have to sweat the small stuff.

Take Dijit’s toolbar buttons. In the editor, you have a row of graphical buttons for bold, italic, etc. For some time the rendering in Firefox has been inconsistent with the other browsers – there’s some extra space around the buttons. The result is that the toolbar is a little wider, and it’s just not tight.

(more…)

Usable directory listings with a little Dojo

Tuesday, April 29th, 2008

I think we’ve all seen Apache directory listings? They are a list of links + icons that detail the contents of the directory. You can go wild with a custom handler to format directory listing requests however you want. But for most cases they work just fine out of the box. They are kind of tedious to browse through though: scroll, scroll, click, or – worse – tab, tab, tab (tab, tab,) enter. A little Dojo magic might go a long way here.

This tutorial shows you how to upgrade those plain vanilla pages to make getting around a little faster and along the way introduce you to some of the most useful bits of Dojo, and practical techniques for working with them. We’ll touch on: dojo.query, dojo.data, the dojo parser and dijit (specifically the FilteringSelect widget.)

(more…)