diff options
-rw-r--r-- | web/app/AttributeFormatter.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index 4b6cb5755..e14a9539b 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -34,9 +34,20 @@ Ext.define('Traccar.AttributeFormatter', { return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit')); }, - alarmFormatter: function (value) { - if (typeof value === 'boolean') { - value = (value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no); + alarmFormatter: function (attributes) { + var value = ''; + if (attributes instanceof Object) {//for Traccar.view.Attributes + if (attributes.hasOwnProperty('alarm')){ + value = attributes.alarm; + if (typeof value === 'boolean') { + value = (value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no); + } + } + } else {//for Traccar.view.Report + value = attributes; + if (typeof value === 'boolean') { + value = (value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no); + } } return '<span style="color:red;">' + value + '</span>'; }, |