diff options
author | Abyss777 <abyss@fox5.ru> | 2016-10-12 11:57:16 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-10-12 11:57:16 +0500 |
commit | 71f8cd7bdf580f48374fbb152bcbf710c54e6c85 (patch) | |
tree | 403eb602662bd4274c3d49376b6972e9b637a5cd /web/app/view | |
parent | 56d37a27017a1e47ec858195d910b438377d47b9 (diff) | |
download | etbsa-traccar-web-71f8cd7bdf580f48374fbb152bcbf710c54e6c85.tar.gz etbsa-traccar-web-71f8cd7bdf580f48374fbb152bcbf710c54e6c85.tar.bz2 etbsa-traccar-web-71f8cd7bdf580f48374fbb152bcbf710c54e6c85.zip |
Autoscroll to selected on map device and position
Diffstat (limited to 'web/app/view')
-rw-r--r-- | web/app/view/DevicesController.js | 5 | ||||
-rw-r--r-- | web/app/view/ReportController.js | 20 | ||||
-rw-r--r-- | web/app/view/StateController.js | 2 |
3 files changed, 19 insertions, 8 deletions
diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js index 0246324..bcdfc6f 100644 --- a/web/app/view/DevicesController.js +++ b/web/app/view/DevicesController.js @@ -32,8 +32,10 @@ Ext.define('Traccar.view.DevicesController', { listen: { controller: { '*': { - selectdevice: 'selectDevice', selectreport: 'selectReport' + }, + 'map': { + selectdevice: 'selectDevice' } }, store: { @@ -143,6 +145,7 @@ Ext.define('Traccar.view.DevicesController', { selectDevice: function (device, center) { this.getView().getSelectionModel().select([device], false, true); + this.getView().getView().focusRow(device); }, selectReport: function (position) { diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index ff5d32f..115769d 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -32,7 +32,9 @@ Ext.define('Traccar.view.ReportController', { listen: { controller: { '*': { - selectdevice: 'selectDevice', + selectdevice: 'selectDevice' + }, + 'map': { selectreport: 'selectReport' } } @@ -126,8 +128,13 @@ Ext.define('Traccar.view.ReportController', { }, onSelectionChange: function (selected) { + var report; if (selected.getCount() > 0) { - this.fireEvent('selectreport', selected.getLastSelected(), true); + report = selected.getLastSelected(); + this.fireEvent('selectreport', report, true); + if (report instanceof Traccar.model.ReportTrip) { + this.selectTrip(report); + } } }, @@ -138,17 +145,18 @@ Ext.define('Traccar.view.ReportController', { }, selectReport: function (object, center) { - if (object instanceof Traccar.model.Position) { + var reportType = this.lookupReference('reportTypeField').getValue(); + if (object instanceof Traccar.model.Position && reportType === 'route') { this.getView().getSelectionModel().select([object], false, true); - } else if (object instanceof Traccar.model.ReportTrip) { - this.selectTrip(object); - } + this.getView().getView().focusRow(object); + } }, selectTrip: function (trip) { var from, to; from = new Date(trip.get('startTime')); to = new Date(trip.get('endTime')); + Ext.getStore('ReportRoute').removeAll(); Ext.getStore('ReportRoute').load({ params: { deviceId: trip.get('deviceId'), diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index b018808..20188e2 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -42,7 +42,7 @@ Ext.define('Traccar.view.StateController', { add: 'updateLatest', update: 'updateLatest' }, - '#Positions': { + '#ReportRoute': { clear: 'clearReport' }, '#AttributeAliases': { |