Dojo charts

If anyone is wondering where I’ve been the past few weeks, I’ve been dealing with the hot-mess called dojox.charting. It’s taken me a week or so to get something up and running, and of that week, 4 days have been dedicated to figuring out why dojo grids tend to fail their connections only after charts have been shown, in a different ContentPane. Wow, I had better things to do with my life:>) Eventually I gave up trying to use dojox.layout.ContentPane and just used regular IFRAME to house the chart component. That seemed to, oddly enough, solve the grid failure problem.

I am going to try to get a working chart demo up on the site in the next few weeks. The chart demos out there are ok for the most basic of charts (where you already have your well formed data, etc) but tend to oversimplify a bit. My goal is to put something a bit more challenging up on the screen.

Leave a Comment

Looking at Adobe Air

Some of my co-workers had recently recommended that I investigate Adobe Air as a web platform. All of the discussion points sounded good, and it promised to be a nice, corporately sponsored, and fairly disciplined way to put together web clients.

I found an Adobe web site, downloaded the binaries, and got to work. About an hour later, I still had NOTHING. So it looks like there may be some learning curve after all. There is a for-pay IDE out there to work with this AIR technology, but I have enough darn IDEs on my machine, and really don’t desire any more. For now I’ve put that little hobby aside. As I learn more, I will share it with my blog. Whether or not I actually use this thing, I still need to understand it.

Comments (2)

ValidationTextBox in the grid

Back to old grids again… I have recently had to use some validation rules in my dojo grid. It took a while to figure out exactly how this is done if one does not use the grid editors, but instead uses the dijit controls. The layout view object contains all of the references needed to put a custom control into your grid.

weatherlayout=[{cells:[[
{name: 'Time', field: "time",
editor:dojox.grid.editors.Dijit,
editorClass:'dijit.form.ValidationTextBox',
editorProps:{regExp:'\\d{4}',invalidMessage:'This number should always be four digits, between 0000 and 2359'}
},
{name: 'Cloud Cover', field: "cloudcover",
editor: dojox.grid.editors.select,
options: ["Clear","Partly Cloudy","Overcast"]
},
{name: 'Wind Direction', field: "winddirection",
editor:dojox.grid.editors.Dijit,
editorClass:'dijit.form.NumberTextBox',
constraint:{min:0,max:359},
editorProps:{required:true}
},
{name: 'Wind Speed', field: "windspeed",
editor:dojox.grid.editors.Dijit,
editorClass:'dijit.form.NumberTextBox',
constraint:{min:0,max:60},
editorProps:{required:true}
},
{name: 'Temp C', field: "temperaturec",
editor:dojox.grid.editors.Dijit,
editorClass:'dijit.form.NumberTextBox',
constraint:{min:0,max:50},
editorProps:{required:true}
},
{name: 'RH%', field: "relativehumidity",
editor:dojox.grid.editors.Dijit,
editorClass:'dijit.form.NumberTextBox',
constraint:{min:0,max:100},
editorProps:{required:true}
}
]]}];

This layout is used in the dojo grid control to define how the grid is displayed. The first column, time, needs a special validation rule. I want to make sure that only 4 dijit numbers are accepted into the control. In order to do this, I first define the fact that I want to use a dijit editor, then I provide a string that identifies the exact dijit class that I want to use. Here is the tricky part… If I want this dijit control to have any custom behavior or initialization settings, I need to specify those using the editorProps object. This editorProps object is used as a mixin later on. Appearantly what happens is that when the grid needs an editor, a new item of the editorClass type is created, and the editorProps are “mixed-in” to form the new object. The approach is pretty slick, but can be a little non-sensical to Object Oriented purists.

One might ask, “What is the difference between editorProps and constraint objects?” The only real difference is that constraint objects get mixed into the normal set of grid editors, and the editorProps get mixed into Dijit controls.

Leave a Comment

New Sample Project for Grids, Trees, Layout, and Containers.

As promised, I have built a new project that contains everything you will need to jump start a Dojo 1.3.2 project.  It contains a border layout main page with three panels.  One of the panels contains some links that allows the viewer to choose whether to see the grid example, or a new tree example.  I use a bit of javascript to make the view change within the body of the original page.

This is a pretty bare bones example, but contains enough to build up a pretty nice first try at Dojo, without all of the learning curve needed to start out.  I reference the aol libraries to keep the size small. It is built as a simple Eclipse project, so it should be very quick to get running. Just import it into your workspace and off you go!

Click Here to download the new example code.

Leave a Comment

post traffic is up

Well, I posted that last project about the dojo grid, and now my hit rate for the blog is way up. I guess this is a fairly popular subject. I think I’ll post a new project along the same no-nonsense lines. This one will be a basic template to set up your dojo pages using JSPs. I will probably post it as an eclipse project as well. Look for that some time in November.

Leave a Comment

Dojo DataGrid post

As promised, I have provided a VERY SIMPLE example of how to display data using the Data Grid.  Given the huge number of tutorials on this subject, I’ll refrain from writing more words on it and simply provide a usable clean example.

The referenced zip file contains an eclipse project with a single jsp and a single json data source.

Click Here to Download

Leave a Comment

Dojo Data Grid

Just an update – I’ve been spending a little time lately wrestling with the DataGrid.  Ok, it’s all documented in the Book Of Dojo, and it still made little sense.  There are so many different grid versions and dojo versions it isn’t even funny.  I took a day and really worked it out.  Finally I got a data store to connect to a grid, and act halfway reasonable.  It turns out that the key was to MAKE SURE that you are on the latest dojo library version (v1.3+).  If you are behind like I was (1.1), you are in for a serious mental beat-down.

When I get a spare hour or so I’ll code it up and post it.  I will hopefully have it up by 21 Oct.  And yes – I will make the project files available as a download as well.

Leave a Comment

A quick word about dojo versions

The dojo team seems to be coding full speed ahead.  There has been a number of version changes and upgrades.  Unfortunately when I started my last project it was on version 1.1.1.  When I upgraded versions to 1.3 a lot of things simply broke.

So instead of doing a lot of work upgrading working code, I froze my build number until a major upgrade gets scheduled.  This means that all of the posts on this blog have been based on dojo 1.1, not on the “latest and greatest”.

So keep that in mind when you are trying these out.

Leave a Comment

New Scientific Notation post is up and running.

A few days ago, I needed to build a web application that had LARGE numbers in it.  As I started using the dijit library, I was surprised that this wasn’t supported.  Even the dojo documentation mentioned there was a need for it, but then simply stated that they had not yet built anything that supported it.  Darn.

Here is what I came up with in a few hours.  Take a look at this solution and see if it might fit your problem.

Leave a Comment

Scientific Notation and Dojo

I’ve been gone this summer, but I should be posting again soon.  I have recently needed to have a dijit Scientific Notation component.  I sure was surprised when I saw that dijit.form.NumberTextBox could not support that simple task.  After looking at using a regular expression for it, I just decided to build a new one and post it up.

I’ll post the source code and document it by 1 Sep 09.

Leave a Comment

Older Posts »