I'm not a web developer. At least, I shouldn't be one. But my role as Technical Architect includes tasks as evaluating different technologies and propose them to be used in projects. AJAX is one of such technologies so I've been playing a little with it lately (you may read other posts here and here).
To evaluate a technology is a broad concept but, in my opinion, no self-respecting software architect can pass without actually coding something (even if it is a little) before making any assessment. Our current AJAX needs were more or less known so the easiest way to go was to select a requirement and code it so I could grasp the complexity. The selected widget was a table (easy, isn't it?)
These were the features I was looking for:
After some research dojo offers a nice table widget that supports sorting and filtering. It can be created programatically and loads JSON data. A nice solid base to begin with. Of course, I've noticed that a developer should know this two technologies to start. This table will need to parse hundreds of thousands of records so I'm quite sure by now that the a lot of the paging work should be made server side. In addition dojo's FilteringTable has memory/performance troubles when the number of rows go beyond several hundreds.
Even though dojo is quite capable of handling the communications DWR just offers a better integration with a Spring/Java backend. Fortunately, DWR uses JSON to transfer data so that's one problem less. I take notes, this is the third technology/tool for a developer to learn. Once here I considered using jMaki to wrap everything but I'm not sure yet if it will be worth it so I left it pending a future revision.
Design is not my best (this is obvious) so here's what I got (at least is based on CSS so easily changeable):
To evaluate a technology is a broad concept but, in my opinion, no self-respecting software architect can pass without actually coding something (even if it is a little) before making any assessment. Our current AJAX needs were more or less known so the easiest way to go was to select a requirement and code it so I could grasp the complexity. The selected widget was a table (easy, isn't it?)
These were the features I was looking for:
- Generic enough
- Sorting
- Paging
- Filtering
- Export to PDF and /or Excel
- Saving to disk
After some research dojo offers a nice table widget that supports sorting and filtering. It can be created programatically and loads JSON data. A nice solid base to begin with. Of course, I've noticed that a developer should know this two technologies to start. This table will need to parse hundreds of thousands of records so I'm quite sure by now that the a lot of the paging work should be made server side. In addition dojo's FilteringTable has memory/performance troubles when the number of rows go beyond several hundreds.
Even though dojo is quite capable of handling the communications DWR just offers a better integration with a Spring/Java backend. Fortunately, DWR uses JSON to transfer data so that's one problem less. I take notes, this is the third technology/tool for a developer to learn. Once here I considered using jMaki to wrap everything but I'm not sure yet if it will be worth it so I left it pending a future revision.
Design is not my best (this is obvious) so here's what I got (at least is based on CSS so easily changeable):
So I started coding quickly and this is what I learned:
I cannot show all the code here as it is quite complex but, as always, if you need a Paging Table you can download the source code from our repository. To use it just declare the following variables:
- Even with dojo and JSON expect to code a lot of Javascript
- dojo documentation is a nightmare (being kind)
- On the other hand, dojo's mailing list is incredible
- dojo works but...don't try too many things...really
- I wasn't brave enough to try to extend the FilteringTable widget
- DWR keeps it simple but it works like a charm
- XHTML / CSS / dojo / JSON / DWR / Java / JSP / jMaki...isn't it too much?
- And even with all those the final code is everything but elegant
- AJAX is not about lightspeed...in any possible way
- I don't have a clue on how am I going to explain all this to a developer
- Firebug is the tool of the year for AJAX developers
I cannot show all the code here as it is quite complex but, as always, if you need a Paging Table you can download the source code from our repository. To use it just declare the following variables:
<link rel="stylesheet" href="css/PagingTable.css" media="screen"/>
<script language="JavaScript">
var tableQuery = "TrivialObject.class";
var showRows = 10;
var numberOfPages = 5;
var headers = ["Trivial Field", "Trivial Date", "Trivial Long"];
var fields = ["trivialField", "trivialDate", "trivialLong"];
var types = ["String", "Date", "Number"];
</script>
<script type='text/javascript' src='dojo/dojo.js'></script>
<script type='text/javascript' src='js/PagingTable.js'></script>
<script language="JavaScript">
var tableQuery = "TrivialObject.class";
var showRows = 10;
var numberOfPages = 5;
var headers = ["Trivial Field", "Trivial Date", "Trivial Long"];
var fields = ["trivialField", "trivialDate", "trivialLong"];
var types = ["String", "Date", "Number"];
</script>
<script type='text/javascript' src='dojo/dojo.js'></script>
<script type='text/javascript' src='js/PagingTable.js'></script>
And include the mark up code anywhere in the body tag:
<jsp:include page="PagingTable.jsp"></jsp:include>
The code available is the preliminary version (only paging, sorting and filtering is available), exporting will be available next (I hope during the week). Once that is also done I may add the option of working in the client (with the current dataset) or the server (with the complete recordset). If you are interested in something more please let me know.

3 comentarios:
> XHTML / CSS / dojo / JSON / DWR /
> Java / JSP / jMaki...isn't it too
> much?
Hey, that's not even a complete list for most projects. :)
A lot of us also need to know SQL and JDBC or Hibernate.
And, as mentioned, knowing Dojo or whatever isn't enough, to use you still need to know JavaScript. So, it's more like
> XHTML / CSS / JavaScript / JSON / Java / SQL / JSP
> plus [Dojo, YUI, jMaki, whatever]
> plus [DWR]
> plus [Hibernate, iBATIS, JDO]
Not to mention some graphic editing now and again :)
Oh, BTY, the new YUI DataTable scales to larger record sets quite well. One of the demos uses 5000 rows.
* http://developer.yahoo.com/yui/datatable/
-Ted.
You should also check out TIBCO General Interface (GI). DWR 2.0 has a sample it ships using GI. GI is an Ajax toolkit with a 6-year track record of use in large businesses for applications of a range of scales. Just how far can Ajax go? Check out developer.tibco.com. FWIW-- there are also code samples there of using GI with not only DWR, but also dojo components (like dojo.storage) if you want to.
--Kevin Hakman
co-founder, GI
Hello. I'm very interested in this framework. Please tell me where I can find it as it seems it's not at the link you specified. Thanks a lot!
Publicar un comentario en la entrada