From e95c2feb3d852379f076a8f9ba83a5cbe39e2555 Mon Sep 17 00:00:00 2001 From: Igor Nurullaev Date: Wed, 4 Sep 2019 17:15:16 +0300 Subject: [PATCH] Update main.js --- Server/static/js/main.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Server/static/js/main.js b/Server/static/js/main.js index 875d69f..629f2cf 100644 --- a/Server/static/js/main.js +++ b/Server/static/js/main.js @@ -49,7 +49,19 @@ var table = new Tabulator("#copters-table", { return animation; } }, - {title: "Batt voltage", field: "batt_voltage"}, + { + title: "Batt voltage", field: "batt_voltage", formatter: function (cell) { + let voltage = cell.getValue(); + if (parseFloat(voltage) > 30) { + cell.getElement().style.background = green; + } else if (voltage) { + cell.getElement().style.background = red; + } else { + cell.getElement().style.background = null; + } + return voltage; + } + }, { title: "Cell voltage", field: "cell_voltage", formatter: function (cell) { let cell_voltage = cell.getValue();