aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorninioe <ninioe@gmail.com>2016-07-17 16:11:39 +0300
committerninioe <ninioe@gmail.com>2016-07-17 16:11:39 +0300
commit9e2ecd2c9ebfcb9b48329a2e736bf6970cc68d5b (patch)
treea83e67ae7301f5f0e246a9bba11c6b3195282718
parent5380ff196c88cc6b57fff62db71e4ab3a05aaa98 (diff)
downloadtrackermap-server-9e2ecd2c9ebfcb9b48329a2e736bf6970cc68d5b.tar.gz
trackermap-server-9e2ecd2c9ebfcb9b48329a2e736bf6970cc68d5b.tar.bz2
trackermap-server-9e2ecd2c9ebfcb9b48329a2e736bf6970cc68d5b.zip
fix alarm formatter to fit both attributes & report
-rw-r--r--web/app/AttributeFormatter.js17
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>';
},