From 2e8b292675f96c6c83a2e495726fbc9e62524f32 Mon Sep 17 00:00:00 2001 From: Jan-Piet Mens Date: Sun, 3 Jan 2016 14:14:50 +0100 Subject: [PATCH] table view shows last voltage for Greenwich devices in battery column closes #73 --- docroot/table/index.html | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/docroot/table/index.html b/docroot/table/index.html index 8784c97..3b94068 100644 --- a/docroot/table/index.html +++ b/docroot/table/index.html @@ -188,19 +188,23 @@ name: 'batt', title: config.column_titles.batt, visible: true, - data: null, - render: function(data, type, row) { - if (typeof data.batt === 'undefined' || data.batt === null) { - return '-'; - } + data: null, + render: function(data, type, row) { + if (typeof data.batt === 'undefined' || data.batt === null) { + return '-'; + } + if (typeof data.batt === 'object') { + // console.log(JSON.stringify(data.batt)); + return data.batt[data.batt.length - 1]['batt'] + "v"; + } - var t = "{{batt}}%"; - if (data.batt < 25) { - t = '' + t + ''; - } - return Mustache.render(t, data); - }, - "targets" : [6], + var t = "{{batt}}%"; + if (data.batt < 25) { + t = '' + t + ''; + } + return Mustache.render(t, data); + }, + "targets" : [6], }, { className: 'cc',