diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-16 22:27:23 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-16 22:27:23 +1200 |
commit | e7187ea46a8ca8a0e8d93a030a9d360249b998fa (patch) | |
tree | 23f3473ce938b31f062b3a0ca469542254daf74d /web/app/AttributeFormatter.js | |
parent | 37f402a3afae13ade44e135ab4ca3e4cf4966425 (diff) | |
download | trackermap-server-e7187ea46a8ca8a0e8d93a030a9d360249b998fa.tar.gz trackermap-server-e7187ea46a8ca8a0e8d93a030a9d360249b998fa.tar.bz2 trackermap-server-e7187ea46a8ca8a0e8d93a030a9d360249b998fa.zip |
Fix attribute formatter functions
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r-- | web/app/AttributeFormatter.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index 294fdaaba..ba77c2072 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -18,17 +18,16 @@ Ext.define('Traccar.AttributeFormatter', { singleton: true, coordinateFormatter: function(value) { - return value.toFixed(5); + return value.toFixed(6); }, speedFormatter: function(value) { return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit')); }, - courseValues: ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'], - courseFormatter: function(value) { - return this.courseValues[Math.floor(value / 45)]; + var courseValues = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW']; + return courseValues[Math.floor(value / 45)]; }, distanceFormatter: function(value) { @@ -36,8 +35,10 @@ Ext.define('Traccar.AttributeFormatter', { }, defaultFormatter: function(value) { - if (value instanceof Number) { + if (typeof value === 'number') { return value.toFixed(2); + } else if (typeof value === 'boolean') { + return value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no; } else if (value instanceof Date) { return Ext.Date.format(value, styles.dateTimeFormat); } |