From a77d458eacad0d5d540e23370a1b43c56de46467 Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Mon, 15 Aug 2016 15:32:21 +0100 Subject: [PATCH] new graph --- app/js/mdot.js | 16 ++++++++++++---- app/test.html | 7 +++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/js/mdot.js b/app/js/mdot.js index b61c73d..c11e5f8 100644 --- a/app/js/mdot.js +++ b/app/js/mdot.js @@ -29,6 +29,9 @@ console.log('model:all',d); this.temporal = {low: 0,high: 0}; }); + this.on('remove', function(){ + $('#output').empty(); + }); this.on('add',function() { this.processAdded(); @@ -122,8 +125,9 @@ _.bindAll(this, 'render', 'refresh', 'update'); this.collection.bind('change reset add remove', this.render, this); - this.template = _.template($('#list-template').html()); - this.render(); + //this.template = _.template($('#list-template').html()); + this.template = _.template($('#loaded-template').html()); + //this.render(); }, refresh: function() { }, update: function() { @@ -136,8 +140,11 @@ }, render: function() { console.log('MDOT:render'); - + $('#output').empty(); var that = this; + that.$el.append(this.template); + + /* var that = this; this.$el.empty(); this.collection.each(function(model) { var events = model.get('events'); @@ -147,7 +154,7 @@ that.$el.append(e); }); - console.log('bah'); + console.log('bah');*/ return this; } }); @@ -208,6 +215,7 @@ // this.collection.url = '/api/mdot/' + this.model.get('device'); this.collection.url = '/apiv2/mdot/' + this.model.get('device'); // this.collection.url = 'http://127.0.0.1:5984/mdot/_design/getDevice/_view/getDevice'; + this.collection.fetch(fetchObj); } else { console.error('Nothing to get!'); diff --git a/app/test.html b/app/test.html index b8c4d90..d67773c 100644 --- a/app/test.html +++ b/app/test.html @@ -21,7 +21,7 @@
- +
@@ -37,7 +37,10 @@ -
+ +