diff options
Diffstat (limited to 'web/app/view/dialog')
-rw-r--r-- | web/app/view/dialog/DeviceDistance.js | 6 | ||||
-rw-r--r-- | web/app/view/dialog/DeviceDistanceController.js | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/web/app/view/dialog/DeviceDistance.js b/web/app/view/dialog/DeviceDistance.js index 14a795ad..f908e45e 100644 --- a/web/app/view/dialog/DeviceDistance.js +++ b/web/app/view/dialog/DeviceDistance.js @@ -38,10 +38,10 @@ Ext.define('Traccar.view.dialog.DeviceDistance', { change: 'onDeviceChange' } }, { - xtype: 'numberfield', + xtype: 'customNumberField', + convert: 'distance', reference: 'totalDistance', - fieldLabel: Strings.deviceTotalDistance, - value: 0 + fieldLabel: Strings.deviceTotalDistance }], buttons: [{ diff --git a/web/app/view/dialog/DeviceDistanceController.js b/web/app/view/dialog/DeviceDistanceController.js index fd106a8d..bd9e059d 100644 --- a/web/app/view/dialog/DeviceDistanceController.js +++ b/web/app/view/dialog/DeviceDistanceController.js @@ -21,7 +21,14 @@ Ext.define('Traccar.view.dialog.DeviceDistanceController', { alias: 'controller.deviceDistance', onDeviceChange: function (combobox, newValue) { + var position; this.lookupReference('setButton').setDisabled(newValue === null); + if (newValue) { + position = Ext.getStore('LatestPositions').findRecord('deviceId', newValue, 0, false, false, true); + if (position) { + this.lookupReference('totalDistance').setValue(position.get('attributes').totalDistance); + } + } }, onSetClick: function (button) { |