简体   繁体   中英

Dojo-Dgrid Dgrid tutoriel

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 :)

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'],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM