2016-05-31 40 views
0

我想開發使用dojox工具包的網格表,如所示。 我已經提到this但沒有爲我工作。 我想要在靜態html頁面中顯示dojox網格表格,並顯式導入所有css和js文件。 我已經爲jqGrid表格做了這個,但不能爲dojox網格表做。 在html頁面中添加了dojo.css,claro.cssclaroGrid.css,Grid.css,dojo.js資源。如何開發dojox數據網格表

<!DOCTYPE HTML> 
<html lang="en"> 
    <head> 
     <meta charset="utf-8"> 
     <title>Demo: dojox.grid.DataGrid View's defaultCell</title> 
     <link rel="stylesheet" href="./css/dojo.css"> 
     <link rel="stylesheet" href="./css/claro.css"> 
     <link rel="stylesheet" href="./css/claroGrid.css"> 
     <link rel="stylesheet" href="./css/Grid.css"> 

     <script src="./js/dojo.js" type="text/javascript"></script> 
    </head> 
    <body class="claro"> 
<script> 
    dojo.require('dojox.grid.DataGrid'); 
    dojo.require('dojo.data.ItemFileWriteStore'); 
    dojo.require('dijit.form.Button'); 
var itemList = [ 
     {alienPop: 320000,humanPop: 56000,planet: 'Zoron'}, 
     {alienPop: 980940,humanPop: 56052,planet: 'Gaxula'}, 
     {alienPop: 200,humanPop: 500,planet: 'Reiutsink'}, 
     ]; 

     dojo.addOnLoad(function() { 

    var itemList = [ 
     {alienPop: 320000,humanPop: 56000,planet: 'Zoron'}, 
     {alienPop: 980940,humanPop: 56052,planet: 'Gaxula'}, 
     {alienPop: 200,humanPop: 500,planet: 'Reiutsink'}, 
     ]; 

    var store = new dojo.data.ItemFileWriteStore({ 
     data: { 
      identifier : 'planet', 

      items: itemList 
     } 
    }); 


    grid.setStore(store); 

    }); 
    </script> 
      <table id="myDataGrid" dojoType="dojox.grid.DataGrid" style="width:400px;"> 
     <thead> 
     <tr><th field="planet" width="33%">Planet</th> 
      <th field="alienPop" width="33%">Aliens</th> 
      <th field="humanPop" width="33%">Humans</th> 
     </tr> 
     </thead> 
    </table> 
    </body> 
</html> 
+0

你到目前爲止嘗試過什麼?請發佈一些你的代碼並嘗試改進你的問題。謝謝! – GibboK

+0

@dkb在您的問題主體中添加代碼。不在評論中。沒有人會閱讀它的評論 – NSNoob

+0

@ NSNoob,謝謝,完成 請參閱本頁:jsfiddle.net/bhagat_dineshbe2006/th3fuek9,它適用於IE瀏覽器。靜態html頁面不工作。 – dkb

回答