From 1fd337e1d4e0bb5877fb9788fabc8c964f0eba39 Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Wed, 22 Feb 2012 21:18:30 +0000 Subject: [PATCH] [#48,refactor][s]: rename DataTable to DataGrid - fixes #48. --- demo/js/app.js | 2 +- index.html | 8 ++++---- src/view-grid.js | 14 +++++++------- src/view.js | 6 +++--- test/view.test.js | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/demo/js/app.js b/demo/js/app.js index d0360492..29bb3da1 100755 --- a/demo/js/app.js +++ b/demo/js/app.js @@ -6,7 +6,7 @@ $(function() { { id: 'grid', label: 'Grid', - view: new recline.View.DataTable({ + view: new recline.View.DataGrid({ model: dataset }) }, diff --git a/index.html b/index.html index a69f2f88..1aaa14a9 100644 --- a/index.html +++ b/index.html @@ -79,9 +79,9 @@
  • Pure javascript (no Flash) and designed for integration -- so it is easy to embed in other sites and applications
  • Open-source
  • -
  • Built on Backbone - so - robust design and extremely easy to exend
  • +
  • Built on the simple but powerful Backbone giving a + clean and robust design which is easy to extend
  • Properly designed model with clean separation of data and presentation
  • Componentized design means you use only what you need
  • @@ -114,7 +114,7 @@

    There are then various Views (you can easily write your own). Each view holds a pointer to a Dataset:

    diff --git a/src/view-grid.js b/src/view-grid.js index 80d9820b..feb02b85 100644 --- a/src/view-grid.js +++ b/src/view-grid.js @@ -2,7 +2,7 @@ this.recline = this.recline || {}; this.recline.View = this.recline.View || {}; (function($, my) { -// ## DataTable +// ## DataGrid // // Provides a tabular view on a Dataset. // @@ -10,8 +10,8 @@ this.recline.View = this.recline.View || {}; // // Additional options passed in second arguments. Options: // -// * cellRenderer: function used to render individual cells. See DataTableRow for more. -my.DataTable = Backbone.View.extend({ +// * cellRenderer: function used to render individual cells. See DataGridRow for more. +my.DataGrid = Backbone.View.extend({ tagName: "div", className: "data-table-container", @@ -205,7 +205,7 @@ my.DataTable = Backbone.View.extend({ this.model.currentDocuments.forEach(function(doc) { var tr = $(''); self.el.find('tbody').append(tr); - var newView = new my.DataTableRow({ + var newView = new my.DataGridRow({ model: doc, el: tr, fields: self.fields, @@ -219,10 +219,10 @@ my.DataTable = Backbone.View.extend({ } }); -// ## DataTableRow View for rendering an individual document. +// ## DataGridRow View for rendering an individual document. // // Since we want this to update in place it is up to creator to provider the element to attach to. -// In addition you must pass in a fields in the constructor options. This should be list of fields for the DataTable. +// In addition you must pass in a fields in the constructor options. This should be list of fields for the DataGrid. // // Additional options can be passed in a second hash argument. Options: // @@ -231,7 +231,7 @@ my.DataTable = Backbone.View.extend({ // corresponding field object and document is the document object. Note // that implementing functions can ignore arguments (e.g. // function(value) would be a valid cellRenderer function). -my.DataTableRow = Backbone.View.extend({ +my.DataGridRow = Backbone.View.extend({ initialize: function(initData, options) { _.bindAll(this, 'render'); this._fields = initData.fields; diff --git a/src/view.js b/src/view.js index bb35adc9..503fa47c 100644 --- a/src/view.js +++ b/src/view.js @@ -23,14 +23,14 @@ this.recline.View = this.recline.View || {}; // // **views**: (optional) the views (Grid, Graph etc) for DataExplorer to // show. This is an array of view hashes. If not provided -// just initialize a DataTable with id 'grid'. Example: +// just initialize a DataGrid with id 'grid'. Example: // //
     // var views = [
     //   {
     //     id: 'grid', // used for routing
     //     label: 'Grid', // used for view switcher
    -//     view: new recline.View.DataTable({
    +//     view: new recline.View.DataGrid({
     //       model: dataset
     //     })
     //   },
    @@ -101,7 +101,7 @@ my.DataExplorer = Backbone.View.extend({
           this.pageViews = [{
             id: 'grid',
             label: 'Grid',
    -        view: new my.DataTable({
    +        view: new my.DataGrid({
                 model: this.model
               })
           }];
    diff --git a/test/view.test.js b/test/view.test.js
    index f969160d..05adb60e 100644
    --- a/test/view.test.js
    +++ b/test/view.test.js
    @@ -2,7 +2,7 @@
     
     module("View");
     
    -test('new DataTableRow View', function () {
    +test('new DataGridRow View', function () {
       var $el = $('');
       $('.fixtures .test-datatable').append($el);
       var doc = new recline.Model.Document({
    @@ -10,7 +10,7 @@ test('new DataTableRow View', function () {
         'b': '2',
         'a': '1'
         });
    -  var view = new recline.View.DataTableRow({
    +  var view = new recline.View.DataGridRow({
         model: doc
         , el: $el
         , fields: new recline.Model.FieldList([{id: 'a'}, {id: 'b'}])
    @@ -21,7 +21,7 @@ test('new DataTableRow View', function () {
       equal(tds.length, 3);
       equal($(tds[1]).attr('data-field'), 'a');
     
    -  var view = new recline.View.DataTableRow({
    +  var view = new recline.View.DataGridRow({
           model: doc
           , el: $el
           , fields: new recline.Model.FieldList([{id: 'a'}, {id: 'b'}])