2013-08-21 63 views
0

試圖模擬http://mleibman.github.io/SlickGrid/examples/example1-simple.htmlhttp://jsfiddle.net/mejo/u5S8T/1/但它不起作用。哪裏不對?無法在Jsfiddle上製作Slickgrid基本示例工作

HTML:

<table width="100%"> 
    <tr> 
    <td valign="top" width="50%"> 
     <div id="myGrid" style="width:600px;height:500px;"></div> 
    </td> 
    <td valign="top"> 
     <h2>Demonstrates:</h2> 
     <ul> 
     <li>basic grid with minimal configuration</li> 
     </ul> 
    </td> 
    </tr> 
</table> 

的JavaScript:

var grid; 
    var columns = [ 
    {id: "title", name: "Title", field: "title"}, 
    {id: "duration", name: "Duration", field: "duration"}, 
    {id: "%", name: "% Complete", field: "percentComplete"}, 
    {id: "start", name: "Start", field: "start"}, 
    {id: "finish", name: "Finish", field: "finish"}, 
    {id: "effort-driven", name: "Effort Driven", field: "effortDriven"} 
    ]; 

    var options = { 
    enableCellNavigation: true, 
    enableColumnReorder: false 
    }; 

    $(function() { 
    var data = []; 
    for (var i = 0; i < 500; i++) { 
     data[i] = { 
     title: "Task " + i, 
     duration: "5 days", 
     percentComplete: Math.round(Math.random() * 100), 
     start: "01/01/2009", 
     finish: "01/05/2009", 
     effortDriven: (i % 5 == 0) 
     }; 
    } 

    grid = new Slick.Grid("#myGrid", data, columns, options); 
    }) 

回答

1

因爲你缺少所需js文件的引用,

 
jquery-1.7.min.js 
jquery.event.drag-2.2.js 
slick.core.js 
slick.grid.js 
+0

我想只有一個缺少的是http:// mleibman。 github.io/SlickGrid/lib/jquery.event.drag-2.2.min.js和問題現在是從哪裏得到的? – MJo

+0

你可以從https://github.com/mleibman/SlickGrid –

+0

http://jsfiddle.net/u5S8T/2/下載它包含現在工作的外部資源謝謝你。然而Slickgrid的例子仍然不起作用,接下來呢? – MJo

相關問題