diff --git a/src/view.js b/src/view.js
index 032a4845..bf1611c9 100644
--- a/src/view.js
+++ b/src/view.js
@@ -220,6 +220,43 @@ recline.DataTable = Backbone.View.extend({
}
});
+// DataTableRow 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 headers in the constructor options. This should be list of headers for the DataTable.
+recline.DataTableRow = Backbone.View.extend({
+ initialize: function(options) {
+ this._headers = options.headers;
+ this.el = $(this.el);
+ },
+ template: ' \
+
| \
+ {{#cells}} \
+ \
+ \
+ | \
+ {{/cells}} \
+ ',
+
+ toTemplateJSON: function() {
+ var doc = this.model;
+ var cellData = _.map(this._headers, function(header) {
+ return {header: header, value: doc.get(header)}
+ })
+ return { id: this.id, cells: cellData }
+ },
+
+ render: function() {
+ this.el.attr('data-id', this.model.id);
+ var html = $.mustache(this.template, this.toTemplateJSON());
+ $(this.el).html(html);
+ return this;
+ }
+});
+
recline.FlotGraph = Backbone.View.extend({
tagName: "div",
diff --git a/test/index.html b/test/index.html
index 3c8d8a96..21d80027 100644
--- a/test/index.html
+++ b/test/index.html
@@ -12,6 +12,8 @@
+
+
@@ -19,9 +21,9 @@
-