2
我想在SlickGrid將數據添加到數據視圖和我有一個代碼:數據添加到數據視圖SlickGrid
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"}
];
$(document).ready(function() {
for (var i = 0; i < 200; i++) {
data[i] = {
id: "id_" + 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)
};
}
dataView = new Slick.Data.DataView({ inlineFilters: true });
grid = new Slick.Grid("#myGrid", dataView, columns, options);
dataView.beginUpdate();
dataView.setItems(data);
dataView.setFilter(filter);
dataView.endUpdate();
});
但我只看到滾動條和列標題,但我沒有看到任何數據,爲什麼呢?
請發表您的HTML以及。你有沒有爲你的#myGrid元素定義寬度/高度? – njr101