I'm trying to follow the simple example of using a DataView with the SlickGrid jQuery plugin. However I can't work out how the data is added to the DataView.
This are the relevant bits of the source:
var dataView;
var grid;
var data = [];
...
$(function() {
// prepare the data
for (var i=0; i<50000; i++) {
var d = (data[i] = {});
d["id"] = "id_" + i;
... add data to d
}
dataView = new Slick.Data.DataView();
grid = new Slick.Grid("#myGrid", dataView, columns, options);
So the grid is now set up, but how does data
get bound to it? I can't see anywhere in the example where it is added, and so I don't know how to add my own data.
Thanks!
Look further down in the source of the example - you'll find the following lines:
// initialize the model after all the events have been hooked up
dataView.beginUpdate();
dataView.setItems(data);
That's where the dataView's items are being set to the data in the data[] array.