[refactor][xs]: rename DataGrid to Grid for simplicity and consistency with file name.
This commit is contained in:
@@ -51,7 +51,7 @@ function standardViews(dataset) {
|
|||||||
{
|
{
|
||||||
id: 'grid',
|
id: 'grid',
|
||||||
label: 'Grid',
|
label: 'Grid',
|
||||||
view: new recline.View.DataGrid({
|
view: new recline.View.Grid({
|
||||||
model: dataset
|
model: dataset
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ also easily write your own). Each view holds a pointer to a Dataset:</p>
|
|||||||
<ul>
|
<ul>
|
||||||
<li>DataExplorer: the parent view which manages the overall app and sets up
|
<li>DataExplorer: the parent view which manages the overall app and sets up
|
||||||
sub views.</li>
|
sub views.</li>
|
||||||
<li>DataGrid: the data grid view.</li>
|
<li>Grid: the data grid view.</li>
|
||||||
<li>Graph: a simple graphing view using <a
|
<li>Graph: a simple graphing view using <a
|
||||||
href="http://code.google.com/p/flot/">Flot</a>.</li>
|
href="http://code.google.com/p/flot/">Flot</a>.</li>
|
||||||
<li>Map: a map view using <a href="http://leaflet.cloudmade.com/">Leaflet</a>.</li>
|
<li>Map: a map view using <a href="http://leaflet.cloudmade.com/">Leaflet</a>.</li>
|
||||||
@@ -270,7 +270,7 @@ are useful:</p>
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="docs/model.html">Models</a></li>
|
<li><a href="docs/model.html">Models</a></li>
|
||||||
<li><a href="docs/view.html">DataExplorer View (plus common view code)</a></li>
|
<li><a href="docs/view.html">DataExplorer View (plus common view code)</a></li>
|
||||||
<li><a href="docs/view-grid.html">DataGrid View</a></li>
|
<li><a href="docs/view-grid.html">(Data) Grid View</a></li>
|
||||||
<li><a href="docs/view-graph.html">Graph View (based on Flot)</a></li>
|
<li><a href="docs/view-graph.html">Graph View (based on Flot)</a></li>
|
||||||
<li><a href="docs/view-map.html">Map View (based on Leaflet)</a></li>
|
<li><a href="docs/view-map.html">Map View (based on Leaflet)</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ this.recline = this.recline || {};
|
|||||||
this.recline.View = this.recline.View || {};
|
this.recline.View = this.recline.View || {};
|
||||||
|
|
||||||
(function($, my) {
|
(function($, my) {
|
||||||
// ## DataGrid
|
// ## (Data) Grid Dataset View
|
||||||
//
|
//
|
||||||
// Provides a tabular view on a Dataset.
|
// Provides a tabular view on a Dataset.
|
||||||
//
|
//
|
||||||
// Initialize it with a `recline.Model.Dataset`.
|
// Initialize it with a `recline.Model.Dataset`.
|
||||||
my.DataGrid = Backbone.View.extend({
|
my.Grid = Backbone.View.extend({
|
||||||
tagName: "div",
|
tagName: "div",
|
||||||
className: "recline-grid-container",
|
className: "recline-grid-container",
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ my.DataGrid = Backbone.View.extend({
|
|||||||
this.model.currentDocuments.forEach(function(doc) {
|
this.model.currentDocuments.forEach(function(doc) {
|
||||||
var tr = $('<tr />');
|
var tr = $('<tr />');
|
||||||
self.el.find('tbody').append(tr);
|
self.el.find('tbody').append(tr);
|
||||||
var newView = new my.DataGridRow({
|
var newView = new my.GridRow({
|
||||||
model: doc,
|
model: doc,
|
||||||
el: tr,
|
el: tr,
|
||||||
fields: self.fields
|
fields: self.fields
|
||||||
@@ -223,22 +223,22 @@ my.DataGrid = Backbone.View.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// ## DataGridRow View for rendering an individual document.
|
// ## GridRow 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.
|
// 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 FieldList in the constructor options. This should be list of fields for the DataGrid.
|
// In addition you *must* pass in a FieldList in the constructor options. This should be list of fields for the Grid.
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
//
|
//
|
||||||
// <pre>
|
// <pre>
|
||||||
// var row = new DataGridRow({
|
// var row = new GridRow({
|
||||||
// model: dataset-document,
|
// model: dataset-document,
|
||||||
// el: dom-element,
|
// el: dom-element,
|
||||||
// fields: mydatasets.fields // a FieldList object
|
// fields: mydatasets.fields // a FieldList object
|
||||||
// });
|
// });
|
||||||
// </pre>
|
// </pre>
|
||||||
my.DataGridRow = Backbone.View.extend({
|
my.GridRow = Backbone.View.extend({
|
||||||
initialize: function(initData) {
|
initialize: function(initData) {
|
||||||
_.bindAll(this, 'render');
|
_.bindAll(this, 'render');
|
||||||
this._fields = initData.fields;
|
this._fields = initData.fields;
|
||||||
|
|||||||
@@ -38,14 +38,14 @@ this.recline.View = this.recline.View || {};
|
|||||||
//
|
//
|
||||||
// **views**: (optional) the dataset views (Grid, Graph etc) for
|
// **views**: (optional) the dataset views (Grid, Graph etc) for
|
||||||
// DataExplorer to show. This is an array of view hashes. If not provided
|
// DataExplorer to show. This is an array of view hashes. If not provided
|
||||||
// just initialize a DataGrid with id 'grid'. Example:
|
// just initialize a Grid with id 'grid'. Example:
|
||||||
//
|
//
|
||||||
// <pre>
|
// <pre>
|
||||||
// var views = [
|
// var views = [
|
||||||
// {
|
// {
|
||||||
// id: 'grid', // used for routing
|
// id: 'grid', // used for routing
|
||||||
// label: 'Grid', // used for view switcher
|
// label: 'Grid', // used for view switcher
|
||||||
// view: new recline.View.DataGrid({
|
// view: new recline.View.Grid({
|
||||||
// model: dataset
|
// model: dataset
|
||||||
// })
|
// })
|
||||||
// },
|
// },
|
||||||
@@ -107,7 +107,7 @@ my.DataExplorer = Backbone.View.extend({
|
|||||||
this.pageViews = [{
|
this.pageViews = [{
|
||||||
id: 'grid',
|
id: 'grid',
|
||||||
label: 'Grid',
|
label: 'Grid',
|
||||||
view: new my.DataGrid({
|
view: new my.Grid({
|
||||||
model: this.model
|
model: this.model
|
||||||
})
|
})
|
||||||
}];
|
}];
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
(function ($) {
|
(function ($) {
|
||||||
|
|
||||||
module("View - DataGrid");
|
module("View - Grid");
|
||||||
|
|
||||||
test('menu - hideColumn', function () {
|
test('menu - hideColumn', function () {
|
||||||
var dataset = Fixture.getDataset();
|
var dataset = Fixture.getDataset();
|
||||||
var view = new recline.View.DataGrid({
|
var view = new recline.View.Grid({
|
||||||
model: dataset
|
model: dataset
|
||||||
});
|
});
|
||||||
$('.fixtures .test-datatable').append(view.el);
|
$('.fixtures .test-datatable').append(view.el);
|
||||||
@@ -22,7 +22,7 @@ test('menu - hideColumn', function () {
|
|||||||
|
|
||||||
test('state', function () {
|
test('state', function () {
|
||||||
var dataset = Fixture.getDataset();
|
var dataset = Fixture.getDataset();
|
||||||
var view = new recline.View.DataGrid({
|
var view = new recline.View.Grid({
|
||||||
model: dataset,
|
model: dataset,
|
||||||
state: {
|
state: {
|
||||||
hiddenFields: ['z']
|
hiddenFields: ['z']
|
||||||
@@ -35,7 +35,7 @@ test('state', function () {
|
|||||||
view.remove();
|
view.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('new DataGridRow View', function () {
|
test('new GridRow View', function () {
|
||||||
var $el = $('<tr />');
|
var $el = $('<tr />');
|
||||||
$('.fixtures .test-datatable').append($el);
|
$('.fixtures .test-datatable').append($el);
|
||||||
var doc = new recline.Model.Document({
|
var doc = new recline.Model.Document({
|
||||||
@@ -43,7 +43,7 @@ test('new DataGridRow View', function () {
|
|||||||
'b': '2',
|
'b': '2',
|
||||||
'a': '1'
|
'a': '1'
|
||||||
});
|
});
|
||||||
var view = new recline.View.DataGridRow({
|
var view = new recline.View.GridRow({
|
||||||
model: doc
|
model: doc
|
||||||
, el: $el
|
, el: $el
|
||||||
, fields: new recline.Model.FieldList([{id: 'a'}, {id: 'b'}])
|
, fields: new recline.Model.FieldList([{id: 'a'}, {id: 'b'}])
|
||||||
|
|||||||
Reference in New Issue
Block a user