table view shows last voltage for Greenwich devices in battery column

closes #73
This commit is contained in:
Jan-Piet Mens 2016-01-03 14:14:50 +01:00
parent 865e986d3d
commit 2e8b292675

View File

@ -188,19 +188,23 @@
name: 'batt', name: 'batt',
title: config.column_titles.batt, title: config.column_titles.batt,
visible: true, visible: true,
data: null, data: null,
render: function(data, type, row) { render: function(data, type, row) {
if (typeof data.batt === 'undefined' || data.batt === null) { if (typeof data.batt === 'undefined' || data.batt === null) {
return '-'; return '-';
} }
if (typeof data.batt === 'object') {
// console.log(JSON.stringify(data.batt));
return data.batt[data.batt.length - 1]['batt'] + "v";
}
var t = "{{batt}}%"; var t = "{{batt}}%";
if (data.batt < 25) { if (data.batt < 25) {
t = '<span class="warning">' + t + '</span>'; t = '<span class="warning">' + t + '</span>';
} }
return Mustache.render(t, data); return Mustache.render(t, data);
}, },
"targets" : [6], "targets" : [6],
}, },
{ {
className: 'cc', className: 'cc',