aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/StateController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-07 21:41:51 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-07 21:41:51 +1300
commit7d82aeb8f296a8862e9d64eda029c3184bae089b (patch)
tree90e71661c5befbc47d1e2cd04f0cc0664dfa86e1 /web/app/view/StateController.js
parent477375744b788f4ae63cf6cd3812a80b2065a487 (diff)
downloadtrackermap-server-7d82aeb8f296a8862e9d64eda029c3184bae089b.tar.gz
trackermap-server-7d82aeb8f296a8862e9d64eda029c3184bae089b.tar.bz2
trackermap-server-7d82aeb8f296a8862e9d64eda029c3184bae089b.zip
Start map controller refactoring
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]);
+ }
}
}
});