Wednesday, July 16th, 2008

Dojo Grid Widget Updated. Data Integration and Editing Improvements.

Category: Dojo

Dojo developers will be pleased to read about the recent update to the Dojo grid control. Version 1.2 of the grid control focuses primarily on improving integration with Dojo data stores, improved grid layout handling and providing advanced in-place editing capabilities. The update was fairly extensive forcing the team to rethink the design of the widget and refactor quite a bit of code. As such, the updated version of the grid has been setup as a new control allowing developers to continue to use the older version while being able to take advantage the updated features. This will ensure that applications based on the previous grid control won’t break.

The biggest benefit truly is the tighter coupling between the new DataGrid and Dojo’s existing stores:

In order to use stores with the grid in previous releases, you needed the model which would bridge the gap between the grid and the store. DataGrid has been engineered to remove that bridge. Instead of using stand-alone models to store data for the grid, any store that implements the Dojo Data read API can be used. Additionally, DataGrid can use the write and notification API’s if they are available.

For example, the following code will create a new store based off of a JSON file from a URL and populate the new DataGrid by passing it as an option to the DataGrid constructor:


  1. var jsonStore = new{ url: "json/gaskets.json" });
  3. var grid = new dojox.grid.DataGrid({
  4.     id: 'grid',
  5.     query: { part_num: '*' },
  6.     store: jsonStore,
  7.     structure: layout
  8. }, 'gridNode');


Building a solid grid control isn’t an easy task and it seems like the Dojo team have done a great job of enhancing their widget.

Posted by Rey Bango at 8:00 am

3.6 rating from 68 votes


Comments feed TrackBack URI

I am not so fond that the content goes away when you drag the scrollbar. Why not use a pagination widget (previous and next button to show the next x items)?

Comment by Jeria — July 16, 2008

How close is Dojo 1.2 to coming out? I seem to remember that there’s great new debugging stuff coming as well.

Comment by Nosredna — July 16, 2008

It feels really hackish. No, it’s not an easy task, but doing better is possible. I’ve done it. Unfortunately it’s not a public work or I’d share it. :(

Comment by eyelidlessness — July 16, 2008

Dojo 1.2 DataGrid is a major refactoring of the previous version – dojox.Grid, but the code still is located in dojox (x stands for experimental).

Does it mean we can expect another major refactoring before the Grid moves to dojo? … or will it always be a part ot dojox?

Comment by Les — July 16, 2008

I want to use dojo but a kick ass grid is essential to my apps. Unfortunately this still doesn’t make the grade. In this regard, extjs is just so much stronger.

Comment by simongil — July 16, 2008

@Jeria: You can do paging like that if you want; the content going away is the result of the grid being able to handle 100,000 rows of data without it having to load all 100,000 rows at once

@Nosrenda: Dojo 1.2 beta is imminent

@Les: The reason we put the grid in DojoX to begin was so we could do a refactoring like this before dropping it into Dijit. Right now the API should be mostly stable and we’ll be adding features and stabilizing the grid for 1.3. A refactor like this shouldn’t be needed for a long time. That said, you could choose to continue using the 1.1 Grid until 1.3 or later if you prefer.

Comment by bryanforbes — July 17, 2008

I cant let the “‘X’ in dojox stands for experimental” comment stand. Project status is indicated in each dojox project’s README file. The ‘X’ is for eXtensions – some of which are production ready and in regular use. The Grid will eventually move to dijit – when it can meet Dijit’s more stringent requirements – which include fully accessibility, as well as API stability. Other components in dojox will never move to dojo core or dijit – not because they are substandard in any way, but because they are specific in nature and have no place in the core distribution.

Comment by sfoster — July 21, 2008

I am most likely an old school client server developer but why in the heck is “ store based off of a JSON file from a URL” an interesting example. I am interested in displaying the results of a query from a RDBMS like MySQL and the Dojo UI related benefits. This example is just gibberish to me. Might I ask if there is support for that basic column sorting stuff, how about sorting multiple columns, any sort of asynchronous hooks?. I mean in what way is a “based on a file” example useful for a data table grid example? I think either Ajaxian is doing some sort of cut and paste, or Dojo has got a pretty weak table widget.

Comment by sturdyworks — November 1, 2008

Leave a comment

You must be logged in to post a comment.