diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/app/view/state/State.js | 2 | ||||
-rw-r--r-- | web/app/view/state/StateController.js | 38 |
2 files changed, 39 insertions, 1 deletions
diff --git a/web/app/view/state/State.js b/web/app/view/state/State.js index de7cab87f..595d845a2 100644 --- a/web/app/view/state/State.js +++ b/web/app/view/state/State.js @@ -23,7 +23,7 @@ Ext.define('Traccar.view.state.State', { ], controller: 'state', - //store: 'Parameters', + store: 'Parameters', title: strings.state_title, diff --git a/web/app/view/state/StateController.js b/web/app/view/state/StateController.js index 8050bcb88..be9e1a15b 100644 --- a/web/app/view/state/StateController.js +++ b/web/app/view/state/StateController.js @@ -18,7 +18,45 @@ Ext.define('Traccar.view.state.StateController', { extend: 'Ext.app.ViewController', alias: 'controller.state', + config: { + listen: { + controller: { + '*': { + selectDevice: 'selectDevice' + } + } + } + }, + init: function() { + }, + + selectDevice: function(device) { + var position = { + "fixTime":"2012-01-02T01:50:00", + "longitude":130.0, + "latitude":60.0, + "valid":true, + "altitude":0.0, + "speed":0.0, + "course":0.0, + "deviceId":1, + "other":"<info><status>84-20</status></info>", + "deviceTime":"2012-01-02T01:50:00", + "id":29, + "protocol":"gotop" + }; + + var store = Ext.getStore('Parameters'); + + for (var key in position) { + if (position.hasOwnProperty(key) && key !== 'other') { + store.add(Ext.create('Traccar.model.Parameter', { + name: key, + value: position[key] + })); + } + } } }); |