diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-10-12 20:50:26 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-12 20:50:26 +1300 |
commit | 32cfba2f48b2ec73ed282af94bb793dde49b0a72 (patch) | |
tree | 403eb602662bd4274c3d49376b6972e9b637a5cd /web/app | |
parent | 56d37a27017a1e47ec858195d910b438377d47b9 (diff) | |
parent | 71f8cd7bdf580f48374fbb152bcbf710c54e6c85 (diff) | |
download | etbsa-traccar-web-32cfba2f48b2ec73ed282af94bb793dde49b0a72.tar.gz etbsa-traccar-web-32cfba2f48b2ec73ed282af94bb793dde49b0a72.tar.bz2 etbsa-traccar-web-32cfba2f48b2ec73ed282af94bb793dde49b0a72.zip |
Merge pull request #297 from Abyss777/scroll_to_row
Autoscroll to device and position selected on map
Diffstat (limited to 'web/app')
-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': { |