Dojo - first hugs

Now I am working day in day out with dojo, finally I got myself to working with it.

Dojo is the Open Source JavaScript toolkit that helps you build serious applications in less time. It fills in the gaps where JavaScript and browsers don’t go quite far enough, and gives you powerful, portable, lightweight, and tested tools for constructing dynamic interfaces. Dojo lets you prototype interactive widgets quickly, animate transitions, and build Ajax requests with the most powerful and easiest to use abstractions available.

Well, the first day I took all this for real and hoped to build applications in less time using the powerful, portable, lightweight, and tested tools. I’ve learned two things: 1) don’t believe everything and 2) head up.

My first task was to create a simple slider. Since there is no slider widget yet I want to build my own slider and may be make it a widget later. For creating a slider it’s logical to use dojo’s drag’n'drop capabilities. I have created a simple span, which contains the handle that you move relative to the outer span. The offset will be used to determine the slider’s value. Sounds pretty easy.

Buggy
So I downloaded version 0.2.2, the latest version. I used the manual example and got the span to drag quite quickly. Cool. So now I need to catch the onDragEnd event, which gets called when I stop dragging and at this time I will get the drag offset. There my problems started. After almost one day of investigation and unsuccessful asking for help on the irc channel #dojo, I found a post on the mailing list that told me that I need to use the latest svn head version. The 0.2.2 has a bug which doesn’t let the onDragEnd event work. Ok, at least some kind of success.

Poor documentation
So I looked up in the manual on how to check out from the dojo svn. Darn, I just couldn’t get the source checked out. I was already feeling quite stupid about asking so much stuff on the irc channel, so I switched to only searching the mailing lists and finding out myself. Fortunately I had subscribed to the dojo list already quite a while ago, so I could nicely search it (I hate those online archives, they are always so unusable). Soon I found the post I was looking for. The svn has moved and the manual had not been updated yet. I just made sure to try it first before posting on #dojo. Yeap, that works. And the manual got updated right away too. Nice. And the onDragEnd works too. Finally.

Incomplete
Next thing on my list was to get the drag offset by which my slider was moved. Since I had been diving into the source code quite often until now I knew that there is a dragOffset property, that I surely just need to read out. Nothing easier than that, I thought. So I just had to look which of the objects has this property and how I can access it. Mmmh, the DragObject has this property. But the event object that gets passed to my method I call upon onDragEnd does not contain any reference to the DragObject. So I don’t really know how to read out the dragOffset, that is stored in there. Oh man, this seems like some work ahead. Huhu, I found this in the source code.

// FIXME: we need to add dragSources and dragObjects to e

Ok, I think I know what it means, this code here is still pretty much untested, incomplete and in beta, if not alpha state. Obviously noone ever needed to access the data I want to read out, even though it seems a basic thing to do. Ok, I think I need to dive a bit deeper into all this and fix the stuff needed to make it run and get my widget up.

Why not give up and use another framework toolkit?
Dojo seems to be on the right way. I think this is the framework toolkit that does it right. It is just the same thing that I would write, in fact I had started just exactly the same thing a while ago but never even got close to where dojo is now. As sophisticated and well thought through as dojo seems, I think it has a shiny future.
The browser stuff is abstracted for DOM, events, drag’n'drop and all the other nice things. The widget system seems really clever and promising. I just hope the mistake of only allowing one widget of each type will not be made (like PEAR did).

I just scratched the surface of dojo, but I got a very good feeling of how dojo works and what the intent behind it is. Even though I think the learning curve is still quite steep because of the lacking docs and missing examples (there are some, but little) I am sure dojo, once it is at a more mature state, will become a JavaScript framework toolkit that you can hardly oversee when evaluating the market.

I’ll stick to dojo and may be I will even try to help out. Good stuff! Congratulations guys!

[Update] After reading some of the dojo.book, I had to replace all the frameworks by toolkits. Even though I think this distinction is irrelevant, but anyway.

2 Comments »

  1. Markus said,

    March 7, 2006 at 10:27 am

    Have you considered looking at the Yahoo UI Library at http://developer.yahoo.net/yui/ ? It already comes with quite some widgets.

  2. hkpwrmga said,

    August 1, 2012 at 4:47 pm

    JZWJqjjmJ Louis Vuitton Outlet wOdWYwlT

RSS feed for comments on this post · TrackBack URL

Leave a Comment