Posts filed under 'ajax'
Simple Dojo Grid
Hi Friends. I was working on a simple data grid using Dojo. Thanks to SitePen’s blogs. It was quite useful except for the fact that i messed up with the css and took some time to make over.
Dojo makes an intensive use of JSON and it’s really a brilliant idea which is evolving quite firmly. We are there to use JSON more in the future.
Try to deploy in any web server and make sure the Dojo, Digit and Dojox are in the path of this file which we deploy.
<html><head>
<script type=”text/javascript” src=”dojo/dojo.js” djconfig=”parseOnLoad: true, isDebug: false”> </script>
<script type=”text/javascript” src=”dojox/grid/Grid.js”></script>
<style type=”text/css”>
@import “dojox/grid/_grid/tundraGrid.css”;
</style>
<script type=”text/javascript”>
var data = [
[ '4001', 'SB', '19/10/1983', '19/10/1920' ],
[ '4002', 'SB', '20/10/1983', '20/10/1920' ],
[ '4003', 'FD', '21/10/1983', '21/10/1920' ],
[ '4004', 'FD', '22/10/1983', '22/10/1920' ]
];
var cell = { name: ‘Cell Name’ };
var subrow = [ cell ];
var view = { rows: subrow };
var structure = [ view ];
var subrow = [
{ name: 'Account Number' },
{ name: 'Account Type' },
{ name: 'Start Date' },
{ name: 'Expiry Date' }
];
var view = {
rows: [ subrow ]
};
var structure = [
view
];
var model = new dojox.grid.data.Table(null, data);
</script>
</head><body class=”tundra”>
<div id=”grid1″ dojotype=”dojox.Grid” autowidth=”true” model=”model” structure=”structure” class=”grid”/>
</body></html>
PS:- Try the latest Dojo version to avoid any mishaps.
Oho… This is not the way to go. Try dojo toolkit version 1.2 grid like given here
One problem regarding working on DOJO is the lack of documentation and heavy depencendy on search engines. This has been felt/discussed in many places. When i had to find the list of dijit widgets i could not get proper answers. Finally found this link: http://redesign.dojotoolkit.org/jsdoc/dijit/HEAD/dijit.form.
And do write in your comments when you try to populate grid using JSON or any other technique.
2 comments September 30, 2008