aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/StateController.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/StateController.js')
-rw-r--r--web/app/view/StateController.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js
index 4b8236aa7..98adb6b11 100644
--- a/web/app/view/StateController.js
+++ b/web/app/view/StateController.js
@@ -25,16 +25,16 @@ Ext.define('Traccar.view.StateController', {
selectDevice: 'selectDevice',
selectReport: 'selectReport'
}
+ },
+ store: {
+ '#LatestPositions': {
+ add: 'update',
+ update: 'update'
+ }
}
}
},
- init: function () {
- var store = Ext.getStore('LatestPositions');
- store.on('add', this.add, this);
- store.on('update', this.update, this);
- },
-
keys: {
fixTime: {
priority: 1,
@@ -128,15 +128,15 @@ Ext.define('Traccar.view.StateController', {
console.log(position);
},
- add: function (store, data) {
- if (this.deviceId === data[0].get('deviceId')) {
- this.updatePosition(data[0]);
- }
- },
-
update: function (store, data) {
- if (this.deviceId === data.get('deviceId')) {
- this.updatePosition(data);
+ var i;
+ if (!Ext.isArray(data)) {
+ data = [data];
+ }
+ for (i = 0; i < data.length; i++) {
+ if (this.deviceId === data[i].get('deviceId')) {
+ this.updatePosition(data[0]);
+ }
}
}
});