aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/ReportController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-10-12 20:50:26 +1300
committerGitHub <noreply@github.com>2016-10-12 20:50:26 +1300
commit32cfba2f48b2ec73ed282af94bb793dde49b0a72 (patch)
tree403eb602662bd4274c3d49376b6972e9b637a5cd /web/app/view/ReportController.js
parent56d37a27017a1e47ec858195d910b438377d47b9 (diff)
parent71f8cd7bdf580f48374fbb152bcbf710c54e6c85 (diff)
downloadtrackermap-web-32cfba2f48b2ec73ed282af94bb793dde49b0a72.tar.gz
trackermap-web-32cfba2f48b2ec73ed282af94bb793dde49b0a72.tar.bz2
trackermap-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/view/ReportController.js')
-rw-r--r--web/app/view/ReportController.js20
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'),