From 4ddc9fbd11395760dc69c04cb806ba173676f56c Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 12 Jun 2015 18:47:39 +1200 Subject: Populate state with dummy data --- web/app/view/state/State.js | 2 +- web/app/view/state/StateController.js | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) (limited to 'web/app/view/state') 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":"84-20", + "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] + })); + } + } } }); -- cgit v1.2.3