diff --git a/docs/tutorial-views.markdown b/docs/tutorial-views.markdown index 88fbf561..750bb065 100644 --- a/docs/tutorial-views.markdown +++ b/docs/tutorial-views.markdown @@ -40,10 +40,6 @@ Before writing any code with Recline, you need to do the following preparation s --> {% endhighlight %} -4. Create a div to hold the Recline view(s): - {% highlight html %} -
{% endhighlight %} - You're now ready to start working with Recline. ### Creating a Dataset @@ -61,37 +57,62 @@ no reason you cannot have objects as values allowing you to nest data. We can now create a recline Dataset object (and memory backend) from this raw data: {% highlight javascript %} -var dataset = recline.Backend.Memory.createDataset(data); +var dataset = new recline.Model.Dataset({ + records: data +}); {% endhighlight %} -Note that behind the scenes Recline will create a Memory backend for this dataset as in Recline every dataset object must have a backend from which it can push and pull data. In the case of in-memory data this is a little artificial since all the data is available locally but this makes more sense for situations where one is connecting to a remote data source (and one which may contain a lot of data). - ### Setting up the Grid -Let's create a data grid view to display the dataset we have just created, binding the view to the `` we created earlier: + +Let's create a data grid view to display the dataset we have just created. We're going to use the SlickGrid-based grid so we need the following: + +{% highlight html %} + + + + + + + + + +{% endhighlight %} + +Now, let's create an HTML element to for the Grid: + +{% highlight html %} + +{% endhighlight %} + +Now let's set up the Grid: {% highlight javascript %} var $el = $('#mygrid'); -var grid = new recline.View.Grid({ - model: dataset +var grid = new recline.View.SlickGrid({ + model: dataset, + el: $el }); -$el.append(grid.el); +grid.visible = true; grid.render(); {% endhighlight %} And hey presto: -