0
votes

I'm a new developer and im trying the framework Dojo-Toolkit and especially d-grid . So i follow the tutorial (http://dgrid.io/tutorials/1.0/hello_dgrid/) here is my index :

    <html>
<head>
    <meta charset="utf-8">
    <title>Tutorial: Hello dgrid!</title>
    <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/resources/dojo.css">
    <link rel="stylesheet" href="djgrid.css">
    <link rel="stylesheet" href="claro.css">
</head>
<body class="claro">
    <div id="grid"></div>


    <!-- load Dojo -->

    <script src="dojo/dojo.js" data-dojo-config="async: true"></script>
    <script src="dojoconfig.js"></script>
    <script>

      require([ 'dgrid/Grid', 'dojo/domReady!' ], function (Grid) {
    var data = [
        { first: 'Bob', last: 'Barker', age: 89 },
        { first: 'Vanna', last: 'White', age: 55 },
        { first: 'Pat', last: 'Sajak', age: 65 }
    ];

    var grid = new Grid({
        columns: {
            first: 'First Name',
            last: 'Last Name',
            age: 'Age'
        }
    }, 'grid');
    grid.renderArray(data);
});
    </script>
</body>
</html>

So when i run on "localhost/DOJO/index.html" i get this error :

http://localhost/DOJO/dgrid/Grid.js Failed to load resource: the server responded with a status of 404 (Not Found)

I dont understand why it search on this location ... and also i get 2 :

Error: scriptError(…)

If someone can tell me how that work that ll be lovely :)

1
Where are dojo and dgrid located on your server? Did you follow dgrid's installation instructions? Also, if you're defining dojoConfig in dojoconfig.js, that needs to be loaded before dojo.js.Ken Franqueiro
They are located at "C:\wamp\www\DOJO" and "C:\wamp\www\DOJO" , what should i have on my dojoconfig.js ? i replace it before dojo.js btw thanks !Fares
If I'm interpreting you correctly then you have www\DOJO\dojo and www\DOJO\dgrid, but the 404 you're getting would suggest that your dgrid folder isn't at that location. If your dojo and dgrid packages are siblings, that should just work...Ken Franqueiro
Thank you,:) so yes, i did not have the right directory structure on my server ...rookie mistakeFares

1 Answers

0
votes

Even if the problem seems solved, this answer will clarify Ken's comments and help other people who try to integrate DGrid to Dojo.

Your code require a dgrid/Grid module the same way it require the dojo\domReady

require([ 'dgrid/Grid','dojo/domReady!'], ...);

so your dgrid folder have to be at the same level as your dojo folder.

  • DOJO
    • app
    • dgrid
    • dijit
    • dojo
    • dojox

In your dojoConfig.js, you should have a line like :

packages: ['dojo', 'dijit', 'dojox', 'app', 'dgrid'],