[#48,refactor][s]: rename DataTable to DataGrid - fixes #48.
This commit is contained in:
parent
1abf2769bd
commit
1fd337e1d4
@ -6,7 +6,7 @@ $(function() {
|
||||
{
|
||||
id: 'grid',
|
||||
label: 'Grid',
|
||||
view: new recline.View.DataTable({
|
||||
view: new recline.View.DataGrid({
|
||||
model: dataset
|
||||
})
|
||||
},
|
||||
|
||||
@ -79,9 +79,9 @@
|
||||
<li>Pure javascript (no Flash) and designed for integration -- so it is
|
||||
easy to embed in other sites and applications</li>
|
||||
<li>Open-source</li>
|
||||
<li>Built on <a
|
||||
href="http://documentcloud.github.com/backbone/">Backbone</a> - so
|
||||
robust design and extremely easy to exend</li>
|
||||
<li>Built on the simple but powerful <a
|
||||
href="http://documentcloud.github.com/backbone/">Backbone</a> giving a
|
||||
clean and robust design which is easy to extend</li>
|
||||
<li>Properly designed model with clean separation of data and presentation</li>
|
||||
<li>Componentized design means you use only what you need</li>
|
||||
</ul>
|
||||
@ -114,7 +114,7 @@
|
||||
<p>There are then various Views (you can easily write your own). Each view holds a pointer to a Dataset:</p>
|
||||
<ul>
|
||||
<li>DataExplorer: the parent view which manages the overall app and sets up sub views.</li>
|
||||
<li>DataTable: the data grid / table view.</li>
|
||||
<li>DataGrid: the data grid view.</li>
|
||||
<li>FlotGraph: a simple graphing view using <a href="http://code.google.com/p/flot/">Flot</a>.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@ -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 = $('<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;
|
||||
|
||||
@ -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:
|
||||
//
|
||||
// <pre>
|
||||
// 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
|
||||
})
|
||||
}];
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
module("View");
|
||||
|
||||
test('new DataTableRow View', function () {
|
||||
test('new DataGridRow View', function () {
|
||||
var $el = $('<tr />');
|
||||
$('.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'}])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user