Dojo Tutorials
Using dojo/aspect
Simply put: the Dojo Toolkit has tools that other JavaScript toolkits don't. One of those tools includes Dojo 1.7's aspect, a module that allows developers to react to function calls by executing another function before or after that call. This aspect resource originates from Dojo's awesome connect mechanism. Let's check out how it works!
File Uploads and C:\fakepath\
I was recently working on a project that required providing an AJAX uploading widget to users. I decided to use Dojo's dojox.form.FileInput widget so the "Upload" button would look just like every other button within the web application. Everything worked great until I tested the widget in Chrome and found that the value of the input node was being set to C:\fakepath\{Original File Name}. I then checked Internet Explorer and Safari; both of them were prepending "C:\fakepath" to the file name. WTF?!
Dojo, Dijit, Dropdowns, and _aroundNode
The Dojo Toolkit's awesome UI framework, Dijit, has loads of awesome widgets to allow developers to quickly create themed, feature-rich web applications. Dijit provides form widgets, layout widgets, dropdown-based widgets, and much more. What's nice about Dijit is that there's so much functionality provided that you don't need to code everything yourself. The down side of that? That it can be difficult to find the undocumented pieces of functionality required to accomplish your goal.
JavaScript Coding with Class
I've spent the last two weeks in London, eating fish'n'chips, drinking cup'o'tea, and being a hooligan at the Arsenal. Oh yeah, there was a MooTools hackathon too. The MooTools hackathon was hugely successful and I'll be providing more detail about what was accomplished and where MooTools is going over the coming weeks. It was also great to meet some of the development team in person instead of simple IRC. MooTools FTW!
Custom AJAX Content Handling with the Dojo Toolkit
If you were to ask me for the top five words that should describe any JavaScript framework, one of them would be flexible. The Dojo Toolkit is ultra-flexible in just about every way, using customizable classes and dojo-namespaced objects to to allow for maximal flexibility. One of those dojo-namespaced objects, dojo.contentHandlers, is an object containing key->value pairs for handling the result of AJAX requests. Let me show you how to use these content handlers and how you can create your own!
Full Awesomeness with dojo.partial and MooTools’ Function.partial
Much like MooTools, the Dojo Toolkit features a host of JavaScript language helpers. One of those helpers is dojo.partial. This method, which lives in Dojo Base, allows you to call a method with additional arguments appended to the front of a function signature. Sound a bit weird? It did to me too. Let's take a quick peek at dojo.partial's syntax and when you'd use it.
Create Your Own Dijit CSS Theme with LESS CSS
The Dojo Toolkit seems to just get better and better. One of the new additions in Dojo 1.6 was the use of LESS CSS to create Dijit themes. The move to using LESS is a brilliant one because it makes creating your own Dijit theme much easier. Let's take a look at how Dojo leverages LESS to create Dijit themes and create our own theme.
Using Pub Sub with The Dojo Toolkit
As I've stated many times, the Dojo Toolkit is probably the most complete JavaScript toolkit out there, especially when it comes to event management and application communication. I've already done a very brief introduction to dojo.connect so I thought I'd also do a short introduction to Dojo's other event system: pub/sub with dojo.publish and dojo.subscribe.
Display Unique Results within dijit.form.ComboBox
The Dojo Toolkit does well in allowing easy integration of web services with Dijit widgets via dojo.store.JsonRest. One such widget is the dijit.form.ComboBox, which uses data stores to displays an autosuggest pane populated with items based on the store's contents. One problem I've run into is that some services return duplicate labels (i.e. two persons named "David Walsh"). You want both items if you can use both of them but what if you're using ComboBox for search? You wouldn't want duplicates. That's where I created a small custom class to prevent duplicates within the ComboBox's dropdown menu.
Dojo Tutorials
Over the last few months, I've written several Dojo Toolkit tutorials to help explain basic and intermediate Dojo concepts. Here's a rundown of the tutorials that have been released thus far: