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/ReportController.js | |
parent | 56d37a27017a1e47ec858195d910b438377d47b9 (diff) | |
download | trackermap-web-71f8cd7bdf580f48374fbb152bcbf710c54e6c85.tar.gz trackermap-web-71f8cd7bdf580f48374fbb152bcbf710c54e6c85.tar.bz2 trackermap-web-71f8cd7bdf580f48374fbb152bcbf710c54e6c85.zip |
Autoscroll to selected on map device and position
Diffstat (limited to 'web/app/view/ReportController.js')
-rw-r--r-- | web/app/view/ReportController.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index ff5d32f8..115769d8 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'), |