Opened 10 years ago

Closed 10 years ago

#9453 closed defect (invalid)

Programmatical creation of DataGrid via ItemFileReadStore does not work

Reported by: martin_bo Owned by: Bryan Forbes
Priority: high Milestone: tbd
Component: DojoX Grid Version: 1.3.1
Keywords: dojox.grid programmatic javascript malformed Cc:
Blocked By: Blocking:

Description

I did the following: Downloaded the tarball from http://www.sitepen.com/blog/2008/07/14/dojo-12-grid/. Replaced the old Dojo version by the new 1.3.1 version. And suddenly the programmtical creation examples no longer worked. I tried Firefox 3.0.11 in Windows/Linux? and Chrome 2. Same result. Firefox is telling me that the Javascript files read by dojo.require are malformed, Chrome tells me: "Resource interpreted as other but transferred with MIME type application/x-javascript." XHR finished loading resource ...

The example worked just fine with the Dojo 1.2 version provided in the above example.

Here is the code for what I'm trying to do:

<!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01 TransitionalEN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>

<title>Programmatic Layout Basic</title> <style type="text/css">

@import "dijit/themes/tundra/tundra.css"; @import "dojox/grid/resources/Grid.css"; @import "dojox/grid/resources/tundraGrid.css"; @import "general.css";

</style> <script type="text/javascript" src="dojo/dojo.js" djConfig="isDebug:false, parseOnLoad: true"></script> <script type="text/javascript">

dojo.require("dojo.data.ItemFileReadStore?"); dojo.require("dojox.grid.DataGrid?");

var jsonStore = new dojo.data.ItemFileReadStore?({ url: "json/gaskets.json" });

var grid = null;

dojo.addOnLoad(function(){

var layout = [

{ field: "part_num", name: "Part Number", width: 'auto' }, { field: "min_temp", name: "Minimum Temperature", width: "100px" }, { field: "max_temp", name: "Maximum Temperature", width: "100px" }, { field: "type", name: "Type", width: "100px" }, { field: "thick", name: "Thickness", width: "5em" }

]; grid = new dojox.grid.DataGrid?({

query: { part_num: '*' }, store: jsonStore, structure: layout

}, 'gridNode');

});

</script>

</head> <body class="tundra">

<h1>Gasket Lookup</h1> <div class="partsContainer">

<div class="gridContainer">

<div id="gridNode"></div>

</div>

</div>

</body> </html>

Change History (2)

comment:1 Changed 10 years ago by martin_bo

Update: I visited the Dojo IRC channel and I think the Sitepen example is wrong there. The example misses a grid.startup() as this is mandatory for programmatic creation as I've been told!

comment:2 Changed 10 years ago by Nathan Toone

Resolution: invalid
Status: newclosed

Closing then.

Note: See TracTickets for help on using tickets.